Skip to content

[ES-2838] changed exception code to give correct error response#1651

Open
KashiwalHarsh wants to merge 2 commits intomosip:developfrom
Infosys:ES-2838
Open

[ES-2838] changed exception code to give correct error response#1651
KashiwalHarsh wants to merge 2 commits intomosip:developfrom
Infosys:ES-2838

Conversation

@KashiwalHarsh
Copy link

@KashiwalHarsh KashiwalHarsh commented Mar 2, 2026

Summary by CodeRabbit

  • Bug Fixes
    • Updated the error code returned when client authentication validation fails during transaction processing from INVALID_CLIENT_ID to INVALID_CLIENT; corresponding test expectations updated for consistency.

Signed-off-by: Harsh Kashiwal <harsh.kashiwal@infosys.com>
@coderabbitai
Copy link

coderabbitai bot commented Mar 2, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cbf090a and f6ffb79.

📒 Files selected for processing (1)
  • oidc-service-impl/src/test/java/io/mosip/esignet/services/OAuthServiceTest.java

Walkthrough

Error code used when a request's client_id mismatches a transaction was changed from INVALID_CLIENT_ID to INVALID_CLIENT in the OAuth service implementation; corresponding test expectation was updated. No other logic changed.

Changes

Cohort / File(s) Summary
OAuth service implementation & tests
oidc-service-impl/src/main/java/io/mosip/esignet/services/OAuthServiceImpl.java, oidc-service-impl/src/test/java/io/mosip/esignet/services/OAuthServiceTest.java
Changed error constant from INVALID_CLIENT_ID to INVALID_CLIENT in validateRequestParametersWithTransaction and updated the unit test assertion to expect INVALID_CLIENT.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A quick hop through lines of code,
I nibbled at a name once showed,
INVALID_CLIENT_ID now INVALID_CLIENT bright,
A tiny tweak, and all feels right,
I clap my paws — a short delight! 🥕

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: updating an exception code from INVALID_CLIENT_ID to INVALID_CLIENT to provide the correct error response.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

Copy link

@coderabbitai coderabbitai bot left a 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

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In
`@oidc-service-impl/src/main/java/io/mosip/esignet/services/OAuthServiceImpl.java`:
- Around line 233-234: The code throws ErrorConstants.INVALID_CLIENT in
OAuthServiceImpl when tokenRequest.getClient_id() mismatches
transaction.getClientId(), but tests (OAuthServiceTest) and the OpenAPI spec
expect INVALID_CLIENT_ID; change the thrown constant to
ErrorConstants.INVALID_CLIENT_ID (or if the project standard is INVALID_CLIENT,
update OAuthServiceTest assertions to expect ErrorConstants.INVALID_CLIENT) so
the token endpoint error code is consistent; update all related token endpoint
tests (e.g., the assertion at OAuthServiceTest line ~421) to match the chosen
constant and ensure alignment with the OAuth spec/OpenAPI.

ℹ️ Review info

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9938969 and cbf090a.

📒 Files selected for processing (1)
  • oidc-service-impl/src/main/java/io/mosip/esignet/services/OAuthServiceImpl.java

Signed-off-by: Harsh Kashiwal <harsh.kashiwal@infosys.com>
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.

1 participant