Skip to content

Add pre-issue access token tests for sessionDataKeyConsent#27309

Open
anjuchamantha wants to merge 2 commits into
wso2:masterfrom
anjuchamantha:next-oauth-759-preissue
Open

Add pre-issue access token tests for sessionDataKeyConsent#27309
anjuchamantha wants to merge 2 commits into
wso2:masterfrom
anjuchamantha:next-oauth-759-preissue

Conversation

@coderabbitai

coderabbitai Bot commented Mar 27, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: de474202-39c8-4b09-a89c-ee46205ced7c

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment on lines +381 to +397
@Test(groups = "wso2.is", dependsOnMethods = "testGetAccessTokenWithAuthCodeGrant",
description = "Verify that the pre issue access token action request contains the session " +
"with a valid sessionDataKeyConsent for authorization code grant")
public void testPreIssueAccessTokenActionRequestContainsSession() throws Exception {

String actualRequestPayload =
serviceExtensionMockServer.getReceivedRequestPayload(MOCK_SERVER_ENDPOINT_RESOURCE_PATH);
PreIssueAccessTokenActionRequest actualRequest =
new ObjectMapper().readValue(actualRequestPayload, PreIssueAccessTokenActionRequest.class);

Session session = actualRequest.getEvent().getSession();
assertNotNull(session, "Session object should be present in the action request for authorization code grant.");
assertNotNull(session.getSessionDataKeyConsent(),
"sessionDataKeyConsent should be present in the session for authorization code grant.");
assertFalse(session.getSessionDataKeyConsent().isEmpty(),
"sessionDataKeyConsent should not be empty.");
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to introduce a new Test case, let's verify the session object related changes in the testPreIssueAccessTokenActionRequest() test method

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed with ca7196e

@sonarqubecloud

Copy link
Copy Markdown

@jenkins-is-staging

Copy link
Copy Markdown
Contributor

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

@jenkins-is-staging

Copy link
Copy Markdown
Contributor

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

@jenkins-is-staging

Copy link
Copy Markdown
Contributor

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

@jenkins-is-staging jenkins-is-staging left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/23636714763

@jenkins-is-staging

Copy link
Copy Markdown
Contributor

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

@jenkins-is-staging

Copy link
Copy Markdown
Contributor

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

@jenkins-is-staging

Copy link
Copy Markdown
Contributor

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

@jenkins-is-staging jenkins-is-staging left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/23636760115

assertNotNull(session.getSessionDataKeyConsent(),
"sessionDataKeyConsent should be present in the session for authorization code grant.");
assertFalse(session.getSessionDataKeyConsent().isEmpty(),
"sessionDataKeyConsent should not be empty.");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we validate the whether the sessionDataKeyConscent value in the action request is equal to the sessionDataKeyConsent variable value as well ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies I have missed this. These type of validations (verifying value in the action request is the actual value) should be covered in other general pre issue action tests.

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.

3 participants