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

[Intermittently] Session Expiry Issue When Removing More Than Two Users Sequentially from a Group #18761

Closed
NilukaSripalim opened this issue Dec 24, 2023 · 4 comments

Comments

@NilukaSripalim
Copy link
Contributor

Describe the issue:
After adding more than two users to a group, attempting to remove more than two users from the group sequentially results in a session expiry.

How to reproduce:

  1. Add more than two users to a group.
  2. Sequentially attempt to remove more than two users from the group.

Expected behavior:
The removal of users from the group should not result in a session expiry.

Environment information (Please complete the following information; remove any unnecessary fields) :

  • Product Version: wso2is-7.0.0-beta5-SNAPSHOT
  • OS: Mac
  • Database: DB2
  • Userstore:JDBC

group-session.webm
@NilukaSripalim NilukaSripalim changed the title Session Expiry Issue When Removing More Than Two Users Sequentially from a Group [Intermittently] Session Expiry Issue When Removing More Than Two Users Sequentially from a Group Dec 24, 2023
@ZiyamSanthosh ZiyamSanthosh self-assigned this Jan 3, 2024
@Thisara-Welmilla Thisara-Welmilla moved this from Open to In Progress in Identity Server 7.0.0 Jan 4, 2024
@ZiyamSanthosh
Copy link
Contributor

Analysis

  1. The issue is not related to deleting multiple users deletion. It occurs during an attempt to delete the admin user from an existing group.
  2. When the admin user is removed from a group, all the tokens related to the admin user is getting revoked. Hence, the session will get expired and the admin gets logged out from the console.
  3. This is an expected behaviour in our current architecture where all tokens related to a user will be revoked after the user gets removed from the group.
    https://github.com/wso2-extensions/identity-inbound-auth-oauth/blob/ae84cb940422ec0b60e1c697cd6f5ddfda3e8348/components/org.wso2.carbon.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth/OAuthUtil.java#L779

The tokens are being revoked since the tokens will have the scopes mapped to relevant permissions which could have been assigned to the user by adding the user to the specific group. To remove those permissions, all the active tokens are being revoked.

Hence this behaviour is expected, reducing the priority of the issue. Further discussed has to be conducted.

FYI @hasanthiP

@ZiyamSanthosh
Copy link
Contributor

ZiyamSanthosh commented Jan 4, 2024

Observations in IS 6.1

Consider that the admin user has logged in to the console.

  1. If the admin user is removed from a group, the token is revoked. Hence the session gets expired and the user gets logged out.
  2. If the admin user is removed from a role, the token is revoked. Hence the session gets expired and the user gets logged out.

Observations in IS 7.0

  1. Same behaviour is restored for user removal from a group scenario.
  2. The session does not get expired when the admin is removed from a role.

Fix for this issue:
Even through the implementation to terminate the session is already implemented with [1], the relevant events are not subscribed for the event handler.

Issue [2] has been created to track this issue.

[1] wso2-extensions/identity-inbound-auth-oauth#2198
[2] #18813

@DMHP
Copy link
Contributor

DMHP commented Jan 5, 2024

Ideally, none of the tokens should be invalidated when an admin user is removed from a certain group. However, when a user's groups are updated, all of the tokens are revoked due to the way we have implemented this. It appears that after the user and group roles are separated, the token revocation process is not being handled correctly. We need to fix this with a proper evaluation.

@isharak
Copy link
Member

isharak commented Nov 7, 2024

This issue is being closed due to extended inactivity. Please feel free to reopen it if further attention is needed. Thank you for helping us keep the issue list relevant and focused!

@isharak isharak added the IceBox label Nov 7, 2024
@isharak isharak closed this as completed Nov 7, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Identity Server 7.0.0 Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

4 participants