Issue-ID: POLICY-5044
Change-Id: Ib9db9fddd5890458c8ec830cef465e9c884f7c40
Signed-off-by: saul.gill <saul.gill@est.tech>
*/
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
- http
- .httpBasic(Customizer.withDefaults())
- .authorizeHttpRequests(authorize -> {
- if (useBasicAuth) {
- authorize.anyRequest().authenticated();
- } else {
- authorize.anyRequest().permitAll();
- }
- })
- .csrf(AbstractHttpConfigurer::disable);
+ if (useBasicAuth) {
+ http
+ .httpBasic(Customizer.withDefaults())
+ .authorizeHttpRequests(authorize -> authorize.anyRequest().authenticated());
+ } else {
+ http
+ .authorizeHttpRequests(authorize -> authorize.anyRequest().permitAll());
+ }
+
+ http.csrf(AbstractHttpConfigurer::disable);
return http.build();
}
}