36
36
import org .springframework .security .config .annotation .method .configuration .EnableGlobalMethodSecurity ;
37
37
import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
38
38
import org .springframework .security .config .annotation .web .configuration .EnableWebSecurity ;
39
- import org .springframework .security .config . annotation . web .configuration . WebSecurityConfigurerAdapter ;
39
+ import org .springframework .security .web .SecurityFilterChain ;
40
40
import org .springframework .security .web .authentication .AnonymousAuthenticationFilter ;
41
41
import org .springframework .security .web .authentication .AuthenticationConverter ;
42
42
import retrofit2 .Retrofit ;
@@ -93,9 +93,19 @@ AuthenticationConverter defaultAuthenticationConverter() {
93
93
}
94
94
95
95
@ Bean
96
- FiatWebSecurityConfigurerAdapter fiatSecurityConfig (
97
- FiatStatus fiatStatus , AuthenticationConverter authenticationConverter ) {
98
- return new FiatWebSecurityConfigurerAdapter (fiatStatus , authenticationConverter );
96
+ public SecurityFilterChain configure (
97
+ HttpSecurity http , FiatStatus fiatStatus , AuthenticationConverter authenticationConverter )
98
+ throws Exception {
99
+ return http .servletApi ()
100
+ .and ()
101
+ .exceptionHandling ()
102
+ .and ()
103
+ .anonymous ()
104
+ .and ()
105
+ .addFilterBefore (
106
+ new FiatAuthenticationFilter (fiatStatus , authenticationConverter ),
107
+ AnonymousAuthenticationFilter .class )
108
+ .build ();
99
109
}
100
110
101
111
@ Bean
@@ -104,29 +114,4 @@ FiatAccessDeniedExceptionHandler fiatAccessDeniedExceptionHandler(
104
114
ExceptionMessageDecorator exceptionMessageDecorator ) {
105
115
return new FiatAccessDeniedExceptionHandler (exceptionMessageDecorator );
106
116
}
107
-
108
- private static class FiatWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
109
- private final FiatStatus fiatStatus ;
110
- private final AuthenticationConverter authenticationConverter ;
111
-
112
- private FiatWebSecurityConfigurerAdapter (
113
- FiatStatus fiatStatus , AuthenticationConverter authenticationConverter ) {
114
- super (true );
115
- this .fiatStatus = fiatStatus ;
116
- this .authenticationConverter = authenticationConverter ;
117
- }
118
-
119
- @ Override
120
- protected void configure (HttpSecurity http ) throws Exception {
121
- http .servletApi ()
122
- .and ()
123
- .exceptionHandling ()
124
- .and ()
125
- .anonymous ()
126
- .and ()
127
- .addFilterBefore (
128
- new FiatAuthenticationFilter (fiatStatus , authenticationConverter ),
129
- AnonymousAuthenticationFilter .class );
130
- }
131
- }
132
117
}
0 commit comments