|
22 | 22 |
|
23 | 23 | import eu.openanalytics.containerproxy.auth.IAuthenticationBackend; |
24 | 24 | import eu.openanalytics.containerproxy.security.FixedDefaultOAuth2AuthorizationRequestResolver; |
| 25 | +import eu.openanalytics.containerproxy.spec.expression.SpecExpressionContext; |
| 26 | +import eu.openanalytics.containerproxy.spec.expression.SpecExpressionResolver; |
25 | 27 | import eu.openanalytics.containerproxy.util.SessionHelper; |
26 | 28 | import net.minidev.json.JSONArray; |
27 | 29 | import net.minidev.json.parser.JSONParser; |
|
54 | 56 | import org.springframework.security.oauth2.core.oidc.user.OidcUser; |
55 | 57 | import org.springframework.security.oauth2.core.oidc.user.OidcUserAuthority; |
56 | 58 | import org.springframework.security.web.authentication.AuthenticationFailureHandler; |
| 59 | +import org.springframework.security.web.authentication.logout.LogoutSuccessHandler; |
57 | 60 | import org.springframework.web.context.request.RequestContextHolder; |
58 | 61 | import org.springframework.web.context.request.ServletRequestAttributes; |
59 | 62 | import org.springframework.web.servlet.support.ServletUriComponentsBuilder; |
@@ -150,6 +153,17 @@ public void customizeContainerEnv(Map<String, String> env) { |
150 | 153 |
|
151 | 154 | env.put(ENV_TOKEN_NAME, client.getAccessToken().getTokenValue()); |
152 | 155 | } |
| 156 | + |
| 157 | + @Inject |
| 158 | + private SpecExpressionResolver specExpressionResolver; |
| 159 | + |
| 160 | + @Override |
| 161 | + public LogoutSuccessHandler getLogoutSuccessHandler() { |
| 162 | + return (request, response, authentication) -> { |
| 163 | + SpecExpressionContext context = SpecExpressionContext.create(authentication.getPrincipal(), authentication.getCredentials()); |
| 164 | + response.sendRedirect(specExpressionResolver.evaluateToString(getLogoutSuccessURL(), context)); |
| 165 | + }; |
| 166 | + } |
153 | 167 |
|
154 | 168 | protected ClientRegistrationRepository createClientRepo() { |
155 | 169 | Set<String> scopes = new HashSet<>(); |
|
0 commit comments