Skip to content
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

RP-Initiated Logout doesn't work #1546

Closed
leorb opened this issue Aug 28, 2019 · 3 comments
Closed

RP-Initiated Logout doesn't work #1546

leorb opened this issue Aug 28, 2019 · 3 comments
Labels
bug Something is not working. package/consent
Milestone

Comments

@leorb
Copy link

leorb commented Aug 28, 2019

Describe the bug

When the browser is directed to the logout endpoint, Hydra responds with "invalid_request" error.

Reproducing the bug

Steps to reproduce the behavior:

  1. Set OAUTH2_ISSUER_URL issuer parameter value for Hydra to a URL that does not contain a trailing slash ie. http://localhost:4444
  2. Start Hydra
  3. Mint an ID token
  4. Go to the logout endpoint, specifying the ID token in the id_token_hint parameter as recommended by the spec
  5. See the error.

Server logs

Stack trace: 
github.com/ory/hydra/consent.(*DefaultStrategy).issueLogoutVerifier
	/go/src/github.com/ory/hydra/consent/strategy_default.go:776
github.com/ory/hydra/consent.(*DefaultStrategy).HandleOpenIDConnectLogout
	/go/src/github.com/ory/hydra/consent/strategy_default.go:941
github.com/ory/hydra/oauth2.(*Handler).LogoutHandler
	/go/src/github.com/ory/hydra/oauth2/handler.go:121
github.com/julienschmidt/httprouter.(*Router).ServeHTTP
	/go/pkg/mod/github.com/julienschmidt/httprouter@v1.2.0/router.go:334

Expected behavior
Hydra should log out the End-User and redirect the browser to the post_logout_redirect_uri.

Environment

  • Version: v1.0.0

Additional context
It seems that the problem is something along these lines:

  1. Hydra appends a slash to the ISSUER_URL (discussed in Issuer url is allways fallowed by / even when defined without #1041 and issuer in discovery document contains trailing '/' #1482)
  2. The issuer + slash are subsequently reflected in the iss field of the token
  3. logout verification fails because the issuer in the id_token_hint is not the same as the issuer specified in the config.

A possible workaround might be to specify the trailing slash in the config file.

@aeneasr
Copy link
Member

aeneasr commented Aug 28, 2019

Nice find! I think this can easily be fixed by TrimRight(..., "/") + "/" here

@aeneasr aeneasr added bug Something is not working. package/consent labels Aug 28, 2019
@aeneasr aeneasr added this to the v1.0.1 milestone Aug 28, 2019
@aeneasr
Copy link
Member

aeneasr commented Aug 28, 2019

Are you up for a PR? :)

@leorb
Copy link
Author

leorb commented Sep 11, 2019

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is not working. package/consent
Projects
None yet
Development

No branches or pull requests

2 participants