Add event properties to POST_ISSUE_ACCESS_TOKEN_V2 event #2898
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.
Purpose
Include additional event properties for POST_ISSUE_ACCESS_TOKEN_V2 event.
Description
This pull request enhances the OAuth token issuance event publishing mechanism by adding more contextual information to the event payload and improving test coverage. The main changes include capturing organization and tenant details, token metadata, and ensuring robust error handling during event publishing.
Event payload enrichment:
USER_TYPE
,CLIENT_ID
,ISSUED_TIME
,EXISTING_TOKEN_USED
,SERVICE_PROVIDER
,ISSUER_ORGANIZATION_ID
,ACCESSING_ORGANIZATION_ID
,TOKEN_ID
, andAPP_RESIDENT_TENANT_ID
inAccessTokenEventUtil.java
to provide more context for downstream consumers.Token metadata propagation:
TOKEN_ID
is set in theOAuthTokenReqMessageContext
when an existing or new token is issued, enabling downstream tracking and auditing. [1] [2]OIDCConstants.java
for all the added event properties, improving code clarity and maintainability. [1] [2]Error handling improvements:
Unit test enhancements:
OAuthEventPublishingUtilTest
to mock new dependencies, set up additional context, and verify the inclusion of new event properties, increasing test coverage and reliability. [1] [2]Refactoring and utility additions:
existingTokenUsed
to safely extract the relevant property from the token request context.