feat: Implement Cognito GlobalSignOut#1701
Open
AbhigyaKrishna wants to merge 2 commits into
Open
Conversation
Address PR floci-io#1701 review: - Add adminGetUser existence check before revoking tokens so a crafted token referencing a nonexistent pool/user returns UserNotFoundException/ ResourceNotFoundException instead of silently writing revocation records and returning 200, matching AdminUserGlobalSignOut and getUser. - Include jti in the invalid-token guard so legacy tokens without a jti claim cannot be used as a sign-out credential, consistent with getUser. - Cover the nonexistent-user path with an integration test.
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.
Summary
Implements the Cognito
GlobalSignOutaction, which was previously anunsupported operation (it fell through to the
UnsupportedOperationdefault inthe JSON dispatcher).
GlobalSignOutis the self-service counterpart to the already-supportedAdminUserGlobalSignOut: instead of admin credentials, it authenticates with thecaller's own access token and invalidates all tokens (access, ID, refresh)
that Cognito issued to that user.
CognitoService.globalSignOut(accessToken)— extracts the username/pool/jtifrom the access token, rejects invalid or already-revoked/signed-out tokens with
NotAuthorizedException, then revokes every issued token for the user via theexisting
revokeAllUserTokens(...).CognitoJsonHandler— addshandleGlobalSignOut(...)and wirescase "GlobalSignOut"into the action dispatch (returns HTTP 200 with an emptybody, matching AWS).
Type of change
fix:)feat:)feat!:orfix!:)AWS Compatibility
New action
GlobalSignOuton theAWSCognitoIdentityProviderServicetarget(AWS JSON 1.1). Wire contract:
{ "AccessToken": "<jwt>" }200with empty JSON body{}NotAuthorizedExceptionfor an invalid, revoked, oralready-signed-out access token.
Behavior mirrors the existing, already-verified
AdminUserGlobalSignOutpath andwas validated end-to-end through the project's integration-test harness
(
GlobalSignOutIntegrationTest), which exercises the real request/responseenvelope: sign-in →
GlobalSignOut→ old access token rejected → old refreshtoken rejected → a fresh login still succeeds.
Checklist
./mvnw testpasses locallyGlobalSignOutIntegrationTest, 9 cases)