-
Notifications
You must be signed in to change notification settings - Fork 155
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
Unexpected redirect to the access-denied page despite valid SSO session #8976
Comments
Two things that are suspicious so far:
Might be an awful timing issue with notifications and token requests happening at the same time... usually that would not be an issue, because a failing notifications request would be fine / we could just ignore it. But since we have the workaround of interpreting the 401 on notifications as "user was logged out in the backend" this turns out this way (redirect to the access denied page). |
@micbar We do the token renewal 10 seconds before the expiration. Is the old access token still accepted during this 10 seconds? Or already rejected when we obtained a new one? |
good question. We need to debug that. |
@dragonchaser Can you give a hint? I think we store the access token in the proxy cache by the sessionID which would mean that the renewal will overwrite the old token in the cache. |
I've tested it by increasing this to 60 seconds. That means Web does the token renewal 60 before a token expires. During that 60 seconds, I tried to curl an authenticated endpoint with the old token, which returned valid Edit: I tested locally with the build-in IDP. Now doing another test with a Keycloak deployment. |
I tried to debug this further, let me try to explain my findings. Right away: I don't think this is a timing issue with the token renewal. I think the notification endpoint just sometimes returns a On Also, I've had scenarios locally where the token renewal and the notification request took place at the very exact time according to the network waterfall diagram - no issues whatsoever. My last finding, which is a bit odd and may be a coincidence: the issue happens when I'm browsing in another browser tab. If I'm in the Web tab directly, I don't get |
Our handling of auth errors indeed does not only redirect to the accessDenied page but also clears all session information from the session storage and removes the user from memory / the application state. I don't know why it then tries to re-authenticate the user (as the accessDenied page is an anonymous page this should not happen). But I can imagine that something ™️ triggers a token renewal after all session information has been removed. |
Needs further debugging as for why the notifications endpoint sometimes runs into a Until then, since this is a P1, I would like to propose that we remove the auth error handler from the notifications 401. I.e. not redirect to |
To add on top of my findings above:
Turns out that doesn't need to be the case. When the browser sets a tab in an inactive state it may affect JS timers and intervals... which kinda invalidates this point. But the following point is still valid and hints that token renewal and notification requests should to along even when they happen at the same time. Either way, I agree with @kulmann 👍 |
agreed @kulmann |
agreed @kulmann |
Has been resolved by not reacting to the 401 from notifications requests anymore... |
Steps to reproduce
Expected behaviour
The WebUI should stay logged in for the time of the SSO session (In this case 8 hours)
Actual behaviour
The browser is redirected to the access-denied page
Network
Environment general
Browser log
The text was updated successfully, but these errors were encountered: