rabbitmq-server
rabbitmq-server copied to clipboard
OAuth 2: support logout when using IDP-initiated flows
Describe the bug
This issue occurs when using idp-initiated configuration. This issue was found when testing oauth2-proxy example (https://rabbitmq.com/docs/oauth2-examples-proxy).
Reproduction steps
- Go to oauth2-proxy root url
- You are redirected to keycloak to login
- Upon successful logon, you are redirected to rabbitmq
- Click on logout
- You are wrongly redirected again back to RabbitMQ
Expected behavior
If end_session_endpoint is configured you should be redirected to that endpoint else to the management.oauth_provider_url.
If you are using oauth2-proxy, the /oauth2/sign_out is the logout endpoint. It removes the cookie associated to the authenticated oauth2-proxy user. However, you can pass a query parameter, rd, with the url for the identity provider to logout the user also from it. This is the configuration used in the oauth2-proxy example that configures the end_session_endpoint.
auth_oauth2.issuer = https://keycloak:8443/realms/test
auth_oauth2.end_session_endpoint = https://localhost:8442/oauth2/sign_out?rd=https://keycloak:8443/realms/test/protocol/openid-connect/logout
Additional context
No response