Skip to content

Conversation

RushanNanayakkara
Copy link
Contributor

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:

  • Added new properties to the token issue event, including USER_TYPE, CLIENT_ID, ISSUED_TIME, EXISTING_TOKEN_USED, SERVICE_PROVIDER, ISSUER_ORGANIZATION_ID, ACCESSING_ORGANIZATION_ID, TOKEN_ID, and APP_RESIDENT_TENANT_ID in AccessTokenEventUtil.java to provide more context for downstream consumers.
  • Introduced logic to resolve and include organization IDs for both issuer and accessing organization, using the organization management service.

Token metadata propagation:

  • Ensured that the TOKEN_ID is set in the OAuthTokenReqMessageContext when an existing or new token is issued, enabling downstream tracking and auditing. [1] [2]
  • Defined new constants in OIDCConstants.java for all the added event properties, improving code clarity and maintainability. [1] [2]

Error handling improvements:

  • Updated the token issuer to catch and log exceptions from event publishing, preventing failures from impacting the token issuance flow.

Unit test enhancements:

  • Expanded the 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:

  • Added a utility method existingTokenUsed to safely extract the relevant property from the token request context.
  • Updated imports and static references to support new features and maintain code consistency. [1] [2] [3] [4]

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/17516436773

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/17516436773
Status: failure

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/17525945184

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/17525945184
Status: failure

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