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

Login while on logout page displays misleading message #295

Closed
tuxmaster5000 opened this issue Apr 11, 2024 · 14 comments · Fixed by #303 or #312
Closed

Login while on logout page displays misleading message #295

tuxmaster5000 opened this issue Apr 11, 2024 · 14 comments · Fixed by #303 or #312

Comments

@tuxmaster5000
Copy link

Jenkins and plugins versions report

Environment
Paste the output here

What Operating System are you using (both controller, and any agents involved in the problem)?

Rock 9.3

Reproduction steps

  1. Log in
  2. log out
  3. re login

Expected Results

That after logging out the token on the IDP will be removed and all session data

Actual Results

The user will be still logged in.

Anything else?

Picture after step 2:
step2

Picture after step 3:
step3

Are you interested in contributing a fix?

No response

@michael-doubez
Copy link
Contributor

Can you please provide more details ?

  • regression or new setup ?
  • version of jenkins and plugin ?
  • mono instance ?
  • oidc provider ?
  • which fields do you use in config ?

The logout of the user is handled by Jenkins itself, I ll check what how we can end up in this situation (sessions were changed recently so it may be a side effect)

@michael-doubez
Copy link
Contributor

I think I understand. When you login in the third step it redirects you to the logout landing page because it is the page you login from.

It is the expected behavior but indeed a bit misleading :D

I ll make a fix in the redirect to redirect to the root url if the redirect url is the logout landing page.

@michael-doubez
Copy link
Contributor

michael-doubez commented Apr 11, 2024

@tuxmaster5000 Can you confirm that if you go to another page before logging back, you don t have this message ?

@michael-doubez michael-doubez changed the title Logout not working Login while on logout page displays misleading message Apr 11, 2024
@tuxmaster5000
Copy link
Author

@michael-doubez ,
before I switched to OpenIDC the system was using ldap before for the user authorisation.
Versions:
Jenkins: 2.453
Add-on: 4.239.v325750a_96f3b_
What do you mean with mono instance? cluster/stand alone? It is an single installation.
oidc provider: Keycloak 24.0.2
Config:
User name field name -> preferred_username
Groups field name -> realm_access.roles[].name
Post logout redirect URL -> Main company page
Enable the 'escape" config in case OpenID will not work.
The other fields are default.

I click on logout, then the first picture will shown, and I have the Login button again.
(On the IDP side I see, that the session is still valid.) When I now click on login again, the second picture will be presented.

@michael-doubez
Copy link
Contributor

When you login, the plugin redirects you to the page you started from. So when you login from the logout page it displays it but the page logic expects you to be logged out. That s why you have this message.

I ll change the login logic to redirect to root url in this specific case.

@tuxmaster5000
Copy link
Author

Thanks.
And what is with the undeleted session on the idp? Or should I open a separate task for this?

@michael-doubez
Copy link
Contributor

michael-doubez commented Apr 15, 2024

You mean the token was not revoked ?

If that is what your are talking about, you should configure

  • logoutFromOpenidProvider = true
  • endSessionEndpoint if you don't use configuration endpoint

@tuxmaster5000
Copy link
Author

Yes, that is an another name for the same. (Under keycloak this will be called session).
But where can I set this? I don't see an option for that:
Screenshot 2024-04-16 at 11-31-59 Security Jenkins

@michael-doubez
Copy link
Contributor

michael-doubez commented Apr 16, 2024

It shows up when you click on "Manual configuration" ...
Damned. I'll have to fix that.

Click on manual, activate it and switch back to "Automatic configuration", it will be kept.

@michael-doubez michael-doubez self-assigned this Apr 16, 2024
@tuxmaster5000
Copy link
Author

Switching back will not work, because the settings will be removed:
Screenshot 2024-04-17 at 10-26-36 Security Jenkins

@tuxmaster5000
Copy link
Author

Now the login works under the UI, but on the IDP not all sessions are removed.
On login, two are created, but only one will be removed:
Screenshot 2024-04-17 at 10-37-31 Keycloak Administration UI
The regular one will be removed, but the offline will be still present.

@michael-doubez
Copy link
Contributor

michael-doubez commented Apr 17, 2024

Ah yes. That's because you requested the refresh token which is not handled at this point.

The reason it is requested is because the wellknown configuration requests all available scopes, including offline_access which in your case triggers the generation of the refresh token. I didn't know it resulted in a open session but it makes sense.

You can fix that by overriding the scopes to specify only what you need: tick the "override Scopes" box in config and remove offline_access.

See: https://wjw465150.gitbooks.io/keycloak-documentation/content/server_admin/topics/sessions/offline.html

@tuxmaster5000
Copy link
Author

Hi @michael-doubez yes this will fix it.
I think it would be helpful to include this in the documentation. (Because I had users with over 30 offline sessions/token on the SSO server today)

@michael-doubez
Copy link
Contributor

michael-doubez commented Apr 19, 2024

Actions:

  • redirect user to home page if login is redirecting to logout page
  • fix config UI about scope overrides not shwoing up in the right config space
  • document scope and lack of refresh token handling

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants