Skip to content

[draft] [feat]: template for limit session count#23

Open
mustafadeel wants to merge 4 commits into
auth0:mainfrom
mustafadeel:feat-template-limit-session-count
Open

[draft] [feat]: template for limit session count#23
mustafadeel wants to merge 4 commits into
auth0:mainfrom
mustafadeel:feat-template-limit-session-count

Conversation

@mustafadeel

Copy link
Copy Markdown

Changes

Adding a template for limiting session counts as defined in this repo:
https://github.com/abbaspour/actions-gallery/blob/main/post-login/session-count/limit-session-count.js

  • I described the changes on this PR.

References

https://github.com/abbaspour/actions-gallery/blob/main/post-login/session-count/limit-session-count.js

  • I added at least one link to explain why this change is needed.

Checklist

@nelsonmaia

Copy link
Copy Markdown
Contributor

I would consider using session.revoke instead of access.deny for when the count is > MAX_SESSION.

Instead of

if (count >= MAX_SESSION) { api.access.deny('max sessions reached'); }

I would use 

`if (count >= MAX_SESSION) {
    api.session.revoke('max sessions reached');
}`

While both will deny the user authentication, using access.deny won't invalidate the session and if the user clicks login again, he will be redirected straight to the same error page. This UX can be confusing for the user.

Using session.revoke, when the user clicks login, credentails will be asked again

@mustafadeel

mustafadeel commented Sep 16, 2024

Copy link
Copy Markdown
Author

I would consider using session.revoke instead of access.deny for when the count is > MAX_SESSION.

Instead of

if (count >= MAX_SESSION) { api.access.deny('max sessions reached'); }

I would use 

`if (count >= MAX_SESSION) {
    api.session.revoke('max sessions reached');
}`

While both will deny the user authentication, using access.deny won't invalidate the session and if the user clicks login again, he will be redirected straight to the same error page. This UX can be confusing for the user.

Using session.revoke, when the user clicks login, credentails will be asked again

thanks! i've updated it. Small note, also changed to > MAX_SESSIONS instead of >= :)

@mustafadeel
mustafadeel marked this pull request as ready for review September 19, 2024 15:13
@mustafadeel
mustafadeel requested a review from a team as a code owner September 19, 2024 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants