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

Session created by the OAuth flow should be short lived #1584

Closed
thingersoft opened this issue Apr 9, 2024 · 5 comments
Closed

Session created by the OAuth flow should be short lived #1584

thingersoft opened this issue Apr 9, 2024 · 5 comments
Assignees
Labels
status: invalid An issue that we don't feel is valid

Comments

@thingersoft
Copy link

thingersoft commented Apr 9, 2024

Describe the bug
Session (Security Context) created following request to the authorization endpoint survives after the related access token has been released.

To Reproduce

  1. Create two simple webapps: an authorization server based on SAS and a basic OAuth client app.
  2. Login into the client webapp through the authorization server.
  3. Logout from the client app (destroy client app session).
  4. Try to login again into the client app

You will find yourself automatically logged in with the same account without being asked for consent and/or having the chance to switch to a different account.
This is due to the session-stored security context created during the authorization grant issuing phase.

Expected behavior
I would expect the security context to be destroyed after access token has been issued.
I think this should be the default (and possibly configurable) behaviour.

I would be happy to contribute but I would like to hear comments before coming up with a PR.

@thingersoft thingersoft added the type: bug A general bug label Apr 9, 2024
@jgrandja
Copy link
Collaborator

@thingersoft I'm not fully understanding the issue you reported here.

As far as the Session TTL and the Access Token TTL, there is no relation between the two. The Access Token could live longer or shorter than the Session. I'm not sure why you think these 2 should be linked? Did you read this somewhere in the related specs?

You will find yourself automatically logged in with the same account without being asked for consent and/or having the chance to switch to a different account.

Try the Demo Sample and you will see the Logout works as expected - you will need to log in again but consent might not be required if you previously granted consent.

I would expect the security context to be destroyed after access token has been issued.

I don't understand this? Please provide your reasoning for this. Did you read this in one of the related specs?

@jgrandja jgrandja added status: waiting-for-feedback We need additional information before we can continue and removed type: bug A general bug labels Apr 16, 2024
@jgrandja jgrandja self-assigned this Apr 16, 2024
@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Apr 16, 2024
@thingersoft
Copy link
Author

Try the Demo Sample and you will see the Logout works as expected - you will need to log in again but consent might not be required if you previously granted consent.

@jgrandja
I took a quick look at the demo code and it seems like the client is performing an OID Connect logout.

Upon further investigation I see that session management is really up to the single AP so I'm closing the issue.

What I was really looking for probably was the "login" value of the OID prompt parameter, it would be great if Spring AS could add support for it ( #501 upvoted).

Thanks for your time.

@jgrandja
Copy link
Collaborator

@thingersoft

I see that session management is really up to the single AP

That's correct. The authentication sub-system is managed separately from the authorization server. There could be 1 Idp configured or multiple Idp's configured in a federation. Either way, the authentication system is not a concern of Spring Authorization Server. This is typically configured using Spring Security integrations. The only requirement for certain oauth2 flows, e.g. authorization_code, is that the request is authenticated.

gh-501 has quite a few upvotes so it will likely get scheduled for 1.4.

@jgrandja jgrandja added status: invalid An issue that we don't feel is valid and removed status: feedback-provided Feedback has been provided labels Apr 17, 2024
@thingersoft
Copy link
Author

@jgrandja

gh-501 has quite a few upvotes so it will likely get scheduled for 1.4.

Thank you, I would be available for a PR if you want/need.

@jgrandja
Copy link
Collaborator

@thingersoft I'll keep you posted when gh-501 is planned for a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

3 participants