File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
src/main/java/de/doubleslash/keeptime/rest Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 1616
1717package de .doubleslash .keeptime .rest ;
1818
19+ import static org .springframework .security .config .Customizer .withDefaults ;
20+
1921import org .springframework .context .annotation .Bean ;
2022import org .springframework .context .annotation .Configuration ;
2123import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
2224import org .springframework .security .config .annotation .web .configuration .EnableWebSecurity ;
25+ import org .springframework .security .config .annotation .web .configurers .AbstractHttpConfigurer ;
2326import org .springframework .security .config .http .SessionCreationPolicy ;
24-
2527import org .springframework .security .web .SecurityFilterChain ;
2628
2729@ Configuration
@@ -30,15 +32,11 @@ public class SecurityConfiguration {
3032
3133 @ Bean
3234 public SecurityFilterChain filterChain (final HttpSecurity http ) throws Exception {
33- http .sessionManagement (session -> session .sessionCreationPolicy (SessionCreationPolicy .STATELESS ))
34- .authorizeRequests ()
35- .anyRequest ()
36- .authenticated ()
37- .and ()
38- .httpBasic ()
39- .and ()
40- .csrf ()
41- .disable ();
35+ http .csrf (AbstractHttpConfigurer ::disable )
36+ .sessionManagement (session -> session .sessionCreationPolicy (SessionCreationPolicy .STATELESS ))
37+ .authorizeHttpRequests (auth -> auth .anyRequest ().authenticated ())
38+ .httpBasic (withDefaults ());
39+
4240 return http .build ();
4341 }
4442}
You can’t perform that action at this time.
0 commit comments