|
55 | 55 | import org.springframework.security.core.authority.SimpleGrantedAuthority;
|
56 | 56 | import org.springframework.security.core.userdetails.User;
|
57 | 57 | import org.springframework.security.core.userdetails.UsernameNotFoundException;
|
58 |
| -import org.springframework.security.saml.SAMLAuthenticationProvider; |
59 |
| -import org.springframework.security.saml.SAMLBootstrap; |
60 |
| -import org.springframework.security.saml.SAMLCredential; |
61 |
| -import org.springframework.security.saml.SAMLEntryPoint; |
62 |
| -import org.springframework.security.saml.SAMLLogoutFilter; |
63 |
| -import org.springframework.security.saml.SAMLProcessingFilter; |
| 58 | +import org.springframework.security.saml.*; |
64 | 59 | import org.springframework.security.saml.context.SAMLContextProvider;
|
65 | 60 | import org.springframework.security.saml.context.SAMLContextProviderImpl;
|
66 | 61 | import org.springframework.security.saml.key.EmptyKeyManager;
|
@@ -128,6 +123,16 @@ public SAMLLogoutFilter samlLogoutFilter() {
|
128 | 123 | new LogoutHandler[]{userLogoutHandler, securityContextLogoutHandler()});
|
129 | 124 | }
|
130 | 125 |
|
| 126 | + /** |
| 127 | + * Filter responsible for the `/saml/SingleLogout` endpoint. This makes it possible for users to logout in the IDP |
| 128 | + * or any other application and get automatically logged out in ShinyProxy as well. |
| 129 | + */ |
| 130 | + @Bean |
| 131 | + public SAMLLogoutProcessingFilter samlLogoutProcessingFilter() { |
| 132 | + return new SAMLLogoutProcessingFilter(successLogoutHandler(), |
| 133 | + securityContextLogoutHandler()); |
| 134 | + } |
| 135 | + |
131 | 136 | @Bean
|
132 | 137 | public SecurityContextLogoutHandler securityContextLogoutHandler() {
|
133 | 138 | SecurityContextLogoutHandler logoutHandler = new SecurityContextLogoutHandler();
|
@@ -322,6 +327,7 @@ public SAMLFilterSet samlFilter() throws Exception {
|
322 | 327 | List<SecurityFilterChain> chains = new ArrayList<SecurityFilterChain>();
|
323 | 328 | chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/login/**"), samlEntryPoint()));
|
324 | 329 | chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/logout/**"), samlLogoutFilter()));
|
| 330 | + chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SingleLogout/**"), samlLogoutProcessingFilter())); |
325 | 331 | chains.add(new DefaultSecurityFilterChain(new AntPathRequestMatcher("/saml/SSO/**"), samlWebSSOProcessingFilter()));
|
326 | 332 | return new SAMLFilterSet(chains);
|
327 | 333 | }
|
|
0 commit comments