Impersonation via keycloak not working
Let's say we have 2 users, admin, and user
We are connected as admin and we want to impersonate user
Expected Behavior
We are trying to use keycloak impersonation through oauth2-proxy, but we don't know how we go from an access/refresh token in our backend to a authenticated user in oauth2-proxy/keycloak
Within our backend, connected as admin we are able to use the keycloak protocol/openid-connect/token exchange token api to retrieve an access/refresh token, belonging to user.
But at this point, we don't know what to do in order for oauth2-proxy to use these tokens. There is no route for that right? I assume the login process is completely different than the keycloak OIDC one, so there is no way for us to tell oauth2-proxy to use the access/refresh token right?
The only way I see is to forge the oauth2-proxy token from our backend, but that does not seems healthy :)
Your Environment
- oauth2-proxy v7.3.0
- keycloak 19.0.3.
keycloak-oidcprovider.- OAUTH2_PROXY_PASS_ACCESS_TOKEN set to true so we have the accessToken accessible in our backend code.
Source: oauth2-proxy/oauth2-proxy