-
Notifications
You must be signed in to change notification settings - Fork 88
[INJICERT-976] Add automated API tests for Pre-Authorized Code flow #581
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: INJICERT-976
Are you sure you want to change the base?
[INJICERT-976] Add automated API tests for Pre-Authorized Code flow #581
Conversation
Signed-off-by: Hitesh C <[email protected]>
Signed-off-by: amaydixit11 <[email protected]>
Signed-off-by: amaydixit11 <[email protected]>
Signed-off-by: amaydixit11 <[email protected]>
… for credential configuration Signed-off-by: amaydixit11 <[email protected]>
… credential configuration Signed-off-by: amaydixit11 <[email protected]>
…fferResponse in cache Signed-off-by: amaydixit11 <[email protected]>
…deService for pre-authorized code flow Signed-off-by: amaydixit11 <[email protected]>
…ffer ID Signed-off-by: amaydixit11 <[email protected]>
…gging and validation Signed-off-by: amaydixit11 <[email protected]>
Signed-off-by: amaydixit11 <[email protected]>
…h JSON property annotations Signed-off-by: amaydixit11 <[email protected]>
…alidation Signed-off-by: amaydixit11 <[email protected]>
…thorizedCodeService Signed-off-by: amaydixit11 <[email protected]>
# Conflicts: # certify-service/src/main/java/io/mosip/certify/services/PreAuthorizedCodeService.java
…r and pre-authorized data caching Signed-off-by: amaydixit11 <[email protected]>
Signed-off-by: amaydixit11 <[email protected]>
…e names and ignore URLs for credential offer and pre-authorized data Signed-off-by: amaydixit11 <[email protected]>
…e logic and improved claim validation Signed-off-by: amaydixit11 <[email protected]>
…oyments Signed-off-by: amaydixit11 <[email protected]>
…n multi-pod deployments Signed-off-by: amaydixit11 <[email protected]>
…al offer Signed-off-by: amaydixit11 <[email protected]>
…eService Signed-off-by: amaydixit11 <[email protected]>
Signed-off-by: amaydixit11 <[email protected]>
…h codes Signed-off-by: amaydixit11 <[email protected]>
…clean up code Signed-off-by: amaydixit11 <[email protected]>
…clean up code Signed-off-by: amaydixit11 <[email protected]>
…ess token utility and clean up code Signed-off-by: amaydixit11 <[email protected]>
…etadata service comments Signed-off-by: amaydixit11 <[email protected]>
…est cases Signed-off-by: amaydixit11 <[email protected]>
…er configuration Signed-off-by: amaydixit11 <[email protected]>
…rization servers Signed-off-by: amaydixit11 <[email protected]>
…on and clean up code Signed-off-by: amaydixit11 <[email protected]>
…izationServerMetadataDTO Signed-off-by: amaydixit11 <[email protected]>
…entialConfigurationServiceImplTest Signed-off-by: amaydixit11 <[email protected]>
…nServerMetadata Signed-off-by: amaydixit11 <[email protected]>
…nServerMetadataService Signed-off-by: amaydixit11 <[email protected]>
…tions in WellKnownControllerTest Signed-off-by: amaydixit11 <[email protected]>
…e unused properties Signed-off-by: amaydixit11 <[email protected]>
Signed-off-by: amaydixit11 <[email protected]>
…rom properties Signed-off-by: amaydixit11 <[email protected]>
…PreAuthorizedCodeService Signed-off-by: amaydixit11 <[email protected]>
…-automation-testing
…rios Signed-off-by: amaydixit11 <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (2)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThis PR adds test configuration files and templates for the Pre-Authorized Code Flow feature testing, including YAML test definitions, Handlebars templates for request/response payloads, test case interdependency mappings, and TestNG suite configuration to enable automated testing across six distinct test flows with both positive and negative scenarios. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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. Comment |
|
@coderabbitai review |
✅ Actions performedReview triggered.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In
`@api-test/src/main/resources/injicertify/PreAuthCodeFlow/GetCredentialPreAuth/GetCredentialPreAuthResult.hbs`:
- Around line 1-4: The template GetCredentialPreAuthResult.hbs incorrectly
quotes the credential value which breaks when format === "ldp_vc" because the
API returns a JSON object; update the template to render the credential unquoted
for ldp_vc (use triple-stash {{{credential}}}) and keep the quoted form for
other formats (e.g., use an if/else on the format variable to choose between
"{{credential}}" and {{{credential}}}); modify the block that outputs
"credential" to conditionally use {{{credential}}} when format equals "ldp_vc".
🧹 Nitpick comments (3)
api-test/src/main/resources/injicertify/PreAuthCodeFlow/TokenExchange/TokenExchange.yml (1)
16-20: Tighten token-exchange assertions to avoid false positives.The expected outputs only validate
token_type(and partiallyaccess_token/c_nonce). If the response dropsexpires_inorc_nonce_expires_in, these tests would still pass. Consider asserting the full response shape to prevent regressions.Proposed update to expected outputs
output: '{ "token_type": "Bearer", "access_token": "", - "c_nonce": "" + "expires_in": 0, + "c_nonce": "", + "c_nonce_expires_in": 0 }' @@ output: '{ - "token_type": "Bearer" + "token_type": "Bearer", + "access_token": "", + "expires_in": 0, + "c_nonce": "", + "c_nonce_expires_in": 0 }'Also applies to: 36-38
api-test/src/main/resources/injicertify/PreAuthCodeFlow/PreAuthNegative/PreAuthNegative.yml (1)
72-113: Consider parameterizing expiry bounds to reduce brittleness.The negative expiry tests use hard-coded values (10, 999999). If server min/max changes, these tests may start failing for the wrong reason. If the framework supports config-driven placeholders, consider referencing those bounds instead of fixed numbers.
api-test/src/main/resources/injicertify/PreAuthCodeFlow/GetCredentialOffer/GetCredentialOffer.yml (1)
18-31: Addcredential_configuration_idsassertion for the tx_code case.The tx_code scenario currently skips validating
credential_configuration_ids, so regressions in that field would go unnoticed. Consider asserting it just like the first case.Proposed output shape alignment
output: '{ "credential_issuer": "", + "credential_configuration_ids": [], "grants": {} }'
...in/resources/injicertify/PreAuthCodeFlow/GetCredentialPreAuth/GetCredentialPreAuthResult.hbs
Show resolved
Hide resolved
…dentialPreAuth/GetCredentialPreAuthResult.hbs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Amay Dixit <[email protected]>
…ation fields Signed-off-by: amaydixit11 <[email protected]>
…dentialPreAuth/GetCredentialPreAuthResult.hbs Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Amay Dixit <[email protected]>
…on and token exchange scenarios Signed-off-by: amaydixit11 <[email protected]>
… into INJICERT-976-automation-testing
|



This PR adds comprehensive automated API test coverage for the Pre-Authorized Code flow in Inji Certify, covering both positive and negative scenarios end-to-end.
Changes
Generate Pre-Authorized Code
tx_code)Get Credential Offer
tx_codeToken Exchange
tx_codeGet Credential (Pre-Auth)
Negative test coverage
tx_codeSummary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.