15
15
*/
16
16
package sample .config ;
17
17
18
- import org .springframework .beans .factory .annotation .Autowired ;
19
18
import org .springframework .context .annotation .Bean ;
20
19
import org .springframework .context .annotation .Configuration ;
21
20
import org .springframework .security .config .annotation .web .builders .HttpSecurity ;
31
30
/**
32
31
* @author Joe Grandja
33
32
* @author Dmitriy Dubson
33
+ * @author Steve Riesenberg
34
34
* @since 0.0.1
35
35
*/
36
36
@ EnableWebSecurity
37
37
@ Configuration (proxyBeanMethods = false )
38
38
public class SecurityConfig {
39
39
40
- @ Autowired
41
- private ClientRegistrationRepository clientRegistrationRepository ;
42
-
43
40
@ Bean
44
- WebSecurityCustomizer webSecurityCustomizer () {
45
- return (web ) -> web .ignoring ().requestMatchers ("/webjars/**" );
41
+ public WebSecurityCustomizer webSecurityCustomizer () {
42
+ return (web ) -> web .ignoring ().requestMatchers ("/webjars/**" , "/assets/**" );
46
43
}
47
44
48
45
// @formatter:off
49
46
@ Bean
50
- SecurityFilterChain securityFilterChain (HttpSecurity http ) throws Exception {
47
+ public SecurityFilterChain securityFilterChain (HttpSecurity http ,
48
+ ClientRegistrationRepository clientRegistrationRepository ) throws Exception {
51
49
http
52
50
.authorizeHttpRequests (authorize ->
53
51
authorize
@@ -58,14 +56,15 @@ SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
58
56
oauth2Login .loginPage ("/oauth2/authorization/messaging-client-oidc" ))
59
57
.oauth2Client (withDefaults ())
60
58
.logout (logout ->
61
- logout .logoutSuccessHandler (oidcLogoutSuccessHandler ()));
59
+ logout .logoutSuccessHandler (oidcLogoutSuccessHandler (clientRegistrationRepository )));
62
60
return http .build ();
63
61
}
64
62
// @formatter:on
65
63
66
- private LogoutSuccessHandler oidcLogoutSuccessHandler () {
64
+ private LogoutSuccessHandler oidcLogoutSuccessHandler (
65
+ ClientRegistrationRepository clientRegistrationRepository ) {
67
66
OidcClientInitiatedLogoutSuccessHandler oidcLogoutSuccessHandler =
68
- new OidcClientInitiatedLogoutSuccessHandler (this . clientRegistrationRepository );
67
+ new OidcClientInitiatedLogoutSuccessHandler (clientRegistrationRepository );
69
68
70
69
// Set the location that the End-User's User Agent will be redirected to
71
70
// after the logout has been performed at the Provider
0 commit comments