-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add id_token_hint to the post logout redirect uri #149
base: master
Are you sure you want to change the base?
Conversation
7af5a58
to
5ff1097
Compare
Great work, thank you. |
3fdb802
to
5a1a29c
Compare
The tests fail because The tests do not mock this function and thus a request to I don't know enough about stubbing in Ruby to stub this particular behavior. |
@stanhu can you review this PR or is there somebody else I can talk to? |
@@ -45,7 +45,7 @@ def test_logout_phase_with_discovery | |||
end | |||
|
|||
def test_logout_phase_with_discovery_and_post_logout_redirect_uri | |||
expected_redirect = 'https://example.com/logout?post_logout_redirect_uri=https%3A%2F%2Fmysite.com' | |||
expected_redirect = 'https://example.com/logout?post_logout_redirect_uri=https%3A%2F%2Fmysite.com&id_token_hint' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this value be blank? Should the key be omitted entirely if there is no token?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this needs two tests:
- one with an ID token present (such as this) where the redirect URL should contain the
id_token_hint
param with a value of<id-token>
- one where the ID token is not present and the redirect URL does not contain the
id_token_hint
param
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure whether it's worth the extra effort to create a test case for the second case.
@@ -45,7 +45,7 @@ def test_logout_phase_with_discovery | |||
end | |||
|
|||
def test_logout_phase_with_discovery_and_post_logout_redirect_uri | |||
expected_redirect = 'https://example.com/logout?post_logout_redirect_uri=https%3A%2F%2Fmysite.com' | |||
expected_redirect = 'https://example.com/logout?post_logout_redirect_uri=https%3A%2F%2Fmysite.com&id_token_hint' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
expected_redirect = 'https://example.com/logout?post_logout_redirect_uri=https%3A%2F%2Fmysite.com&id_token_hint' | |
access_token = stub('OpenIDConnect::AccessToken') | |
access_token.stubs(:id_token).returns(jwt.to_s) | |
expected_redirect = "https://example.com/logout?post_logout_redirect_uri=https%3A%2F%2Fmysite.com&id_token_hint=#{access_token.id_token}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your suggestion. I applied them and the case passed.
…direct redirect (without confirmation) with some IdP sofware (keycloak)
Hello everyone! Will this PR be merged at some point? Thanks for your work. |
I would like this to be merged. Are there any concerns with this code? Need any help? |
I also need to send id_token_hint, but this solution doesn't work for my client. I'm using authorization_code flow and the call to |
I found out that even if this gets merged, I still can't use it with Amazon Cognito because they're not compliant with the OpenID Connect logout specification. Cognito uses different URL parameters ( |
The OneLogin IdP requires the
id_token_hint
field to be set to the previously issued access token in the end session uri to perform a logout and redirect the user to the post logout uri.1The Keycloak IdP requires the
id_token_hint
field to be set to avoid a confirmation dialog before redirecting them to the post logout uri.2This PR adds the
id_token_hint
to support this behavior by the IdPs. I'm open to only enabling this through an option that is disabled by default.Footnotes
See OneLogin OIDC post_logout_redirect_uri issue #140 and https://developers.onelogin.com/openid-connect/api/logout ↩
See keycloak documentation: https://www.keycloak.org/docs/latest/securing_apps/#logout ↩