Skip to content

Commit

Permalink
fix for camunda logout issue (#1986)
Browse files Browse the repository at this point in the history
replaced redirect_uri parameter as it no longer supports for keycloak latest version
  • Loading branch information
SnehaSuresh-aot authored Apr 1, 2024
1 parent d5d74ce commit cd0cacc
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ public class KeycloakLogoutHandler implements LogoutSuccessHandler {
/** Keycloak's logout URI. */
private String oauth2UserLogoutUri;

/** Keycloak's Client ID. */
@Value("${keycloak.clientId}")
private String clientId;

/**
* Default constructor.
* @param oauth2UserAuthorizationUri configured keycloak authorization URI
Expand All @@ -53,10 +57,10 @@ public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse resp

if (!ObjectUtils.isEmpty(oauth2UserLogoutUri)) {
// Calculate redirect URI for Keycloak, something like http://<host:port>/camunda/login
String requestUrl = request.getRequestURL().toString();
String redirectUri = requestUrl.substring(0, requestUrl.indexOf("/app"));
var requestUrl = request.getRequestURL().toString();
var redirectUri = requestUrl.substring(0, requestUrl.indexOf("/app"));
// Complete logout URL
String logoutUrl = oauth2UserLogoutUri + "?redirect_uri=" + redirectUri;
var logoutUrl = oauth2UserLogoutUri + "?post_logout_redirect_uri=" + redirectUri + "&client_id=" + clientId;
Cookie[] cookies = request.getCookies();
for (Cookie cookie : cookies) {
LOG.debug("-------cookie---------->"+cookie.getName());
Expand Down

0 comments on commit cd0cacc

Please sign in to comment.