feat: add sessions and refresh-tokens command resources - #1603
Open
developerkunal wants to merge 6 commits into
Open
feat: add sessions and refresh-tokens command resources#1603developerkunal wants to merge 6 commits into
developerkunal wants to merge 6 commits into
Conversation
Update all go-auth0/v2 imports to go-auth0/v3 and rename the v2-flavored identifiers (APIV2, apiv2, managementv2 alias, NewAPIV2, initializeManagementClientV2) to their v3 equivalents. Regenerate the phone-notification-template mock and drop go-auth0/v2 from go.mod. No command surface or behavior changes; v3 is a near drop-in for v2 and none of the tightened v3 types are referenced.
Add `auth0 sessions` and `auth0 refresh-tokens` command groups, plus user-scoped `auth0 users sessions` and `auth0 users refresh-tokens` subcommands, built on the go-auth0 v3 Management SDK. Sessions: show, update (metadata), delete, and revoke a session by id; list and delete all sessions for a user. Refresh tokens: show, update (metadata), delete, and revoke by id, user, user+client, or user+client+audience; list and delete all refresh tokens for a user. Add the read/update/delete scopes for both resources to the login flow, a collectV3Pages helper for v3 cursor pagination, and integration test cases for the non-destructive paths.
Add a --csv flag to the users sessions list and users refresh-tokens list commands, mutually exclusive with --json and --json-compact. Bump go-auth0 to v1.46.0.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔧 Changes
Adds two new top-level command groups,
auth0 sessionsandauth0 refresh-tokens, along with user-scoped subcommands underauth0 users. All are built on the go-auth0 v3 Management SDK.auth0 sessionsshow— display a session's device, clients, and expiryupdate— set or clear session metadatadelete— delete a session by idrevoke— revoke a session and all of its associated refresh tokensauth0 refresh-tokensshow— display a refresh token's client, session, device, and expiryupdate— set or clear refresh token metadatadelete— delete a refresh token by idrevoke— revoke tokens by id, by user, by user + client, or by user + client + audienceauth0 users sessionsandauth0 users refresh-tokenslist— list a user's sessions / refresh tokens (cursor-paginated)delete— delete all of a user's sessions / refresh tokensAlso adds the
read/update/deletescopes for both resources to the login flow, acollectV3Pageshelper that drains v3 cursor-paginated endpoints, and shared date-formatting that renders future expiry timestamps as absolute dates.📚 References
Depends on #1597 (go-auth0 v3 migration); this PR is based on that branch.
🔬 Testing
core.Pagetype alias keeps mockgen able to parse the generic return).test/integration/sessions-test-cases.yaml,refresh-tokens-test-cases.yaml) for the non-destructive paths: empty-list rendering, invalid--number, not-found, and the revoke validation guards.📝 Checklist