1
0
mirror of https://github.com/Stirling-Tools/Stirling-PDF.git synced 2024-11-11 02:10:11 +01:00

Update CustomOAuth2LogoutSuccessHandler.java

This commit is contained in:
Ludy87 2024-05-25 18:25:13 +02:00
parent c2179ccd63
commit 4dcf2f5870
No known key found for this signature in database
GPG Key ID: 92696155E0220F94

View File

@ -37,7 +37,7 @@ public class CustomOAuth2LogoutSuccessHandler extends SimpleUrlLogoutSuccessHand
HttpServletRequest request, HttpServletResponse response, Authentication authentication)
throws IOException, ServletException {
String param = "logout=true";
String provider = null;
String registrationId = null;
String issuer = null;
String clientId = null;
@ -45,21 +45,18 @@ public class CustomOAuth2LogoutSuccessHandler extends SimpleUrlLogoutSuccessHand
if (authentication instanceof OAuth2AuthenticationToken) {
OAuth2AuthenticationToken oauthToken = (OAuth2AuthenticationToken) authentication;
String registrationId = oauthToken.getAuthorizedClientRegistrationId();
registrationId = oauthToken.getAuthorizedClientRegistrationId();
provider = registrationId;
logger.info(registrationId);
Provider pro;
try {
pro = oauth.getClient().get(registrationId);
issuer = pro.getIssuer();
clientId = pro.getClientId();
Provider provider = oauth.getClient().get(registrationId);
issuer = provider.getIssuer();
clientId = provider.getClientId();
} catch (Exception e) {
e.printStackTrace();
}
} else {
provider = oauth.getProvider() != null ? oauth.getProvider() : "";
registrationId = oauth.getProvider() != null ? oauth.getProvider() : "";
issuer = oauth.getIssuer();
clientId = oauth.getClientId();
}
@ -84,7 +81,7 @@ public class CustomOAuth2LogoutSuccessHandler extends SimpleUrlLogoutSuccessHand
logger.info("Session invalidated: " + sessionId);
}
switch (provider) {
switch (registrationId) {
case "keycloak":
// Add Keycloak specific logout URL if needed
String logoutUrl =