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

Add endpoint to get active sessions for user #604

Closed
martynaslawinska opened this issue Feb 12, 2021 · 2 comments
Closed

Add endpoint to get active sessions for user #604

martynaslawinska opened this issue Feb 12, 2021 · 2 comments
Labels
comp-jans-auth-server Component affected by issue or PR kind-enhancement Issue or PR is an enhancement to an existing functionality

Comments

@martynaslawinska
Copy link

Add API /session/active to get active sessions for user. Active sessions are returned for user. User is identified by token (same as in UserInfo case).

POST /session/active HTTP/1.1
Host: server.example.com
Content-Type: application/x-www-form-urlencoded
Authorization: Bearer <access_token>

By default we will return json array without session ids:

[
    {
        "exp": 1419356238,
         "iat": 1419350238,
         "lastUsedAt": 1419350238         
    },
    {
        "exp": 1419356247,
         "iat": 1419350247,
         "lastUsedAt": 1419350247
    }
]

We need Interception Script which should allow to modify response (and include id) if really needed.

E.g.

[
    {
        "exp": 1419356238,
         "iat": 1419350238,
         "lastUsedAt": 1419350238,
         "id": "6d2dda0e-8883-4df8-9429-d4a3504309c6",
         "browser": "chrome"
    },
    {
        "exp": 1419356247,
         "iat": 1419350247,
         "lastUsedAt": 1419350247,
         "id": "332dda0e-8883-4df8-9429-d4a350430933",
         "browser": "firefox"
    }
]

Note: scope required for calling this token endpoint should be configurable by a property (something like activeSessionAuthorizationScope by default.

@yuriyz yuriyz self-assigned this Feb 12, 2021
@nynymike nynymike changed the title Add API to get active sessions for user Add endpoint to get active sessions for user Jul 8, 2021
@yuriyz
Copy link
Contributor

yuriyz commented Dec 21, 2021

Endpoint can be turned on/off by active_session value.

"enabledComponents": [
    "active_session",
    "par",
   ...
]

Token must have scope which is defined by activeSessionAuthorizationScope configuration property.
openid scope is required too, similar to /userinfo endpoint.

@yuriyz
Copy link
Contributor

yuriyz commented Dec 29, 2021

Implemented.
Sample script can be found here.

@yuriyz yuriyz closed this as completed Dec 29, 2021
@ossdhaval ossdhaval transferred this issue from another repository Jan 15, 2022
@ossdhaval ossdhaval added comp-jans-auth-server Component affected by issue or PR kind-enhancement Issue or PR is an enhancement to an existing functionality labels Jan 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp-jans-auth-server Component affected by issue or PR kind-enhancement Issue or PR is an enhancement to an existing functionality
Projects
None yet
Development

No branches or pull requests

3 participants