From 5ed5c0b4d8af83392be9efb3cc5ec9ad85e52ffa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Pi=C4=8Dman?= Date: Wed, 27 Nov 2024 12:22:59 +0100 Subject: [PATCH] Keycloak logout url fix by @melthaw #62 --- lib/redmine_oauth/patches/account_controller_patch.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/redmine_oauth/patches/account_controller_patch.rb b/lib/redmine_oauth/patches/account_controller_patch.rb index d3d8ee8..99f8dc4 100644 --- a/lib/redmine_oauth/patches/account_controller_patch.rb +++ b/lib/redmine_oauth/patches/account_controller_patch.rb @@ -38,11 +38,11 @@ def logout session.delete :oauth_login site = RedmineOauth.site - id = RedmineOauth.client_id url = signout_url case RedmineOauth.oauth_name when 'Azure AD' logout_user + id = RedmineOauth.client_id redirect_to "#{site}/#{id}/oauth2/logout?post_logout_redirect_uri=#{url}" when 'Custom' logout_user @@ -52,9 +52,11 @@ def logout super when 'Keycloak' logout_user - redirect_to "#{site}/realms/#{id}/protocol/openid-connect/logout?redirect_uri=#{url}" + tenant_id = RedmineOauth.tenant_id + redirect_to "#{site}/realms/#{tenant_id}/protocol/openid-connect/logout?redirect_uri=#{url}" when 'Okta' logout_user + id = RedmineOauth.client_id redirect_to "#{site}/oauth2/v1/logout?id_token_hint=#{id}&post_logout_redirect_uri=#{url}" else super