From 202c8ee7c77a328b6c8d48786c20308998ba9f4f Mon Sep 17 00:00:00 2001 From: fnecas Date: Mon, 22 Jan 2024 18:49:24 +0100 Subject: [PATCH] feat: set redirection with oidc too --- .../gateway/security/oauth2/OAuth2Configuration.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gateway/src/main/java/org/georchestra/gateway/security/oauth2/OAuth2Configuration.java b/gateway/src/main/java/org/georchestra/gateway/security/oauth2/OAuth2Configuration.java index 3fbc1961..c69d6b82 100644 --- a/gateway/src/main/java/org/georchestra/gateway/security/oauth2/OAuth2Configuration.java +++ b/gateway/src/main/java/org/georchestra/gateway/security/oauth2/OAuth2Configuration.java @@ -29,6 +29,7 @@ import org.georchestra.gateway.security.ServerHttpSecurityCustomizer; import org.georchestra.gateway.security.ldap.LdapConfigProperties; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -69,6 +70,8 @@ @Slf4j(topic = "org.georchestra.gateway.security.oauth2") public class OAuth2Configuration { + private @Value("${georchestra.gateway.logoutUrl:/?logout}") String georchestraLogoutUrl; + public static final class OAuth2AuthenticationCustomizer implements ServerHttpSecurityCustomizer { public @Override void customize(ServerHttpSecurity http) { @@ -99,7 +102,7 @@ ServerLogoutSuccessHandler oidcLogoutSuccessHandler( OidcClientInitiatedServerLogoutSuccessHandler oidcLogoutSuccessHandler = new OidcClientInitiatedServerLogoutSuccessHandler( clientRegistrationRepository); - oidcLogoutSuccessHandler.setPostLogoutRedirectUri("{baseUrl}/login?logout"); + oidcLogoutSuccessHandler.setPostLogoutRedirectUri("{baseUrl}" + georchestraLogoutUrl); return oidcLogoutSuccessHandler; }