Skip to content

Commit

Permalink
Add id_token_hint to the post logout redirect uri, to facilitate the …
Browse files Browse the repository at this point in the history
…direct redirect (without confirmation) with some IdP sofware (keycloak)
  • Loading branch information
CSDUMMI committed Mar 1, 2023
1 parent af61a91 commit 5ff1097
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/omniauth/strategies/openid_connect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,10 @@ def redirect_uri
def encoded_post_logout_redirect_uri
return unless options.post_logout_redirect_uri

id_token_hint = @access_token.id_token if @acess_token
URI.encode_www_form(
post_logout_redirect_uri: options.post_logout_redirect_uri
post_logout_redirect_uri: options.post_logout_redirect_uri,
id_token_hint: id_token_hint
)
end

Expand Down
2 changes: 1 addition & 1 deletion test/lib/omniauth/strategies/openid_connect_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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'
strategy.options.client_options.host = 'example.com'
strategy.options.discovery = true
strategy.options.post_logout_redirect_uri = 'https://mysite.com'
Expand Down

0 comments on commit 5ff1097

Please sign in to comment.