Closed aloksingh25 closed 2 years ago
Hi @aloksingh25,
can you tell me more about your setup? Logout has been working correctly with the sample checked in.
Gunnar
Hi Gunnar, Please find the details below.
Note: Login is working fine. Even if you notice in yaml "auth" keyword is removed from the URLs for Keyclock 18 and 19. plugin.identity.keycloak: keycloakIssuerUrl: http://localhost:8180/auth/realms/master Regards, Alok Singh Principal Consultant Modernization Practice, Infosys M: 997 123 7696 @.**@. Upcoming Planned Leave(s): NA
From: Gunnar von der Beck @.> Sent: Friday, August 26, 2022 8:47 PM To: camunda-community-hub/camunda-platform-7-keycloak @.> Cc: Alok Singh @.>; Mention @.> Subject: Re: [camunda-community-hub/camunda-platform-7-keycloak] Camunda/ Keyclock logout is not working correctly. (Issue #101)
[EXTERNAL EMAIL]
can you tell me more about your setup? Logout has been working correctly with the sample checked in.
Gunnar
- Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcamunda-community-hub%2Fcamunda-platform-7-keycloak%2Fissues%2F101%23issuecomment-1228624595&data=05%7C01%7Calok.singh25%40infosys.com%7C98420fffce734b79e99b08da87763621%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637971239057705892%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=bQCFhwlXC47vRT5jtzoTnCH4nCrWeii8UeR3iIF6gbo%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPI2CJV5GR2R2MDNJ54LI6LV3DNYDANCNFSM57THAHBA&data=05%7C01%7Calok.singh25%40infosys.com%7C98420fffce734b79e99b08da87763621%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637971239057705892%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=CdPsZUwJdP9vyzHA7cA06LGYKsiL2gEJOB1MJ01fU4U%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.**@.>>
@aloksingh25: Indeed, you're right: starting with Keycloak 18 there are some changes when it comes to the logout procedure. See https://www.keycloak.org/2022/04/keycloak-1800-released / Chapter "OpenID Connect Logout". The current sample is - not yet - adapted to that. What you can do is one of the following:
--spi-login-protocol-openid-connect-legacy-logout-redirect-uri=true
as start parameter for Keycloak - Keycloak then behaves like beforepost_logout_redirect_uri
parameter. How to do this with Spring Boot? See https://developer.okta.com/blog/2020/03/27/spring-oidc-logout-options for a sample on how to use a OidcClientInitiatedServerLogoutSuccessHandler
I will modify and update the sample in future, propably when Camunda 7.18 is released. Does that help?
Gunnar
Hi Gunnar,
Regards, Alok Singh Principal Consultant Modernization Practice, Infosys M: 997 123 7696 @.**@. Upcoming Planned Leave(s): NA
From: Gunnar von der Beck @.> Sent: Monday, August 29, 2022 5:19 PM To: camunda-community-hub/camunda-platform-7-keycloak @.> Cc: Alok Singh @.>; Mention @.> Subject: Re: [camunda-community-hub/camunda-platform-7-keycloak] Camunda/ Keyclock logout is not working correctly. (Issue #101)
[EXTERNAL EMAIL]
@aloksingh25https://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Faloksingh25&data=05%7C01%7Calok.singh25%40infosys.com%7C0133ab1f7f324978463a08da89b4a094%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637973706146585890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Y6UfcV0pDnso7hZNc0SMj%2BwRTvdMVLszj08pSd%2Ftqno%3D&reserved=0: Indeed, you're right: starting with Keycloak 18 there are some changes when it comes to the logout procedure. See https://www.keycloak.org/2022/04/keycloak-1800-releasedhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.keycloak.org%2F2022%2F04%2Fkeycloak-1800-released&data=05%7C01%7Calok.singh25%40infosys.com%7C0133ab1f7f324978463a08da89b4a094%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637973706146585890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=TdRqicY8CX0m7SKL6xRMh6d0BFg%2B%2B2S1q8YOWSjJySM%3D&reserved=0 / Chapter "OpenID Connect Logout". The current sample is - not yet - adapted to that. What you can do is one of the following:
I will modify and update the sample in future, propably when Camunda 7.18 is released. Does that help?
Gunnar
- Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcamunda-community-hub%2Fcamunda-platform-7-keycloak%2Fissues%2F101%23issuecomment-1230179038&data=05%7C01%7Calok.singh25%40infosys.com%7C0133ab1f7f324978463a08da89b4a094%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637973706146585890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=XReMMgcjU2bho7jPYyMp8T%2Bug8I5c0ktImPuE7OK6us%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPI2CJQQX3F63VHKJ2SVHZLV3SPTVANCNFSM57THAHBA&data=05%7C01%7Calok.singh25%40infosys.com%7C0133ab1f7f324978463a08da89b4a094%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637973706146585890%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=pA2wqpXk4epg%2FeiH0HKGDsYxUYaf9BAT6Kg%2BrW7q7bA%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.**@.>>
Hi @aloksingh25,
so please do the following:
1.) Please be aware that in Keycloak you now have to additionally configure "Valid post logout redirect URIs" 2.) Within the existing Keycloak Logout Handler just change the logoutUrl as follows:
// Complete logout URL
String logoutUrl = oauth2UserLogoutUri + "?post_logout_redirect_uri=" + redirectUri + "&id_token_hint=" + ((OidcUser)authentication.getPrincipal()).getIdToken().getTokenValue();
That should do the trick.
Cheers Gunnar
Hi Gunnar, With the below option, redirect is still failing at Camunda app's. Sharing below snaps.
Logout handler: @.***
Keyclock' logout URIs @.***
Regards, Alok Singh Principal Consultant Modernization Practice, Infosys M: 997 123 7696 @.**@. Upcoming Planned Leave(s): NA
From: Gunnar von der Beck @.> Sent: Monday, August 29, 2022 8:36 PM To: camunda-community-hub/camunda-platform-7-keycloak @.> Cc: Alok Singh @.>; Mention @.> Subject: Re: [camunda-community-hub/camunda-platform-7-keycloak] Camunda/ Keyclock logout is not working correctly. (Issue #101)
[EXTERNAL EMAIL]
so please do the following:
1.) Please be aware that in Keycloak you now have to additionally configure "Valid post logout redirect URIs" 2.) Within the existing Keycloak Logout Handler just change the logoutUrl as follows:
// Complete logout URL
String logoutUrl = oauth2UserLogoutUri + "?post_logout_redirect_uri=" + redirectUri + "&id_token_hint=" + ((OidcUser)authentication.getPrincipal()).getIdToken().getTokenValue();
- Reply to this email directly, view it on GitHubhttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcamunda-community-hub%2Fcamunda-platform-7-keycloak%2Fissues%2F101%23issuecomment-1230440913&data=05%7C01%7Calok.singh25%40infosys.com%7Cc40749aa83124741e92808da89d0607a%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637973825325531026%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=2EIICqPSFXpR4Nmre6eGr%2BATKzOMWkzAwJ%2BC%2BIgKilo%3D&reserved=0, or unsubscribehttps://apc01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAPI2CJUU7TMQ6KM4YJBDIW3V3TGUNANCNFSM57THAHBA&data=05%7C01%7Calok.singh25%40infosys.com%7Cc40749aa83124741e92808da89d0607a%7C63ce7d592f3e42cda8ccbe764cff5eb6%7C0%7C0%7C637973825325531026%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MUjIZ6KAgY1OxXgSmbA%2FCOpjA0h6OWv3u9Qsp87EmBo%3D&reserved=0. You are receiving this because you were mentioned.Message ID: @.**@.>>
Hi @aloksingh25,
can you please stop repyling by mail?? This is absolutely unreadable.
Please share your qestion and content in a format so that I can read it on GitHub. Otherwise I will close this issue as "not reproducible". Sorry for being that harsh. Just look at your comments directly on github.com - its disrespectful towards me investing my rare time!
Back to your problem: what will happen upon logout is: you'll get logged out from Keycloak. Keycloak sends a redirect to your app to Camunda Cockpit. And because you're not logged in, this will redirect you back to the login page of Keycloak.
This works with Keycloak 19.0.1, Keycloak config for "Valid post logout redirect URIs", adjusted Keycloak URIs (without "auth") in the application.yaml config and the simple change to the logout handler posted above.
Gunnar
login is success but when logging out from Camunda, it's not working with code given in : examples/sso-kubernetes/src/main/java/org/camunda/bpm/extension/keycloak/showcase/sso/KeycloakLogoutHandler.java
Redirect logout URL: http://localhost:8180/realms/master/protocol/openid-connect/logout?redirect_uri=http://localhost:8082
Camunda 7.17 Keyclock 18.0.0