Fix missing isk claim in ID token for Device Code App Native Auth flow#3184
Fix missing isk claim in ID token for Device Code App Native Auth flow#3184HasiniSama wants to merge 1 commit intowso2-extensions:masterfrom
Conversation
📝 WalkthroughWalkthroughSession context identifier propagation is added to the device authorization flow. A new field is introduced to store the identifier in the cache entry, then propagated from the session cache entry during device authorization and carried forward when issuing device-code tokens. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
...ity.oauth.endpoint/src/main/java/org/wso2/carbon/identity/oauth/endpoint/util/AuthzUtil.java
Show resolved
Hide resolved
...in/java/org/wso2/carbon/identity/oauth2/device/cache/DeviceAuthorizationGrantCacheEntry.java
Show resolved
Hide resolved
...on.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/token/AccessTokenIssuer.java
Show resolved
Hide resolved
...on.identity.oauth/src/main/java/org/wso2/carbon/identity/oauth2/token/AccessTokenIssuer.java
Show resolved
Hide resolved
There was a problem hiding this comment.
AI Agent Log Improvement Checklist
- The log-related comments and suggestions in this review were generated by an AI tool to assist with identifying potential improvements. Purpose of reviewing the code for log improvements is to improve the troubleshooting capabilities of our products.
- Please make sure to manually review and validate all suggestions before applying any changes. Not every code suggestion would make sense or add value to our purpose. Therefore, you have the freedom to decide which of the suggestions are helpful.
✅ Before merging this pull request:
- Review all AI-generated comments for accuracy and relevance.
- Complete and verify the table below. We need your feedback to measure the accuracy of these suggestions and the value they add. If you are rejecting a certain code suggestion, please mention the reason briefly in the suggestion for us to capture it.
| Comment | Accepted (Y/N) | Reason |
|---|---|---|
| #### Log Improvement Suggestion No: 1 | N | This is redundant. |
| #### Log Improvement Suggestion No: 2 | N | This is redundant to add to getters/setters. |
| #### Log Improvement Suggestion No: 3 | N | This is redundant. |
| #### Log Improvement Suggestion No: 4 | N | This is redundant. |
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (0.00%) is below the target coverage (80.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #3184 +/- ##
============================================
+ Coverage 58.77% 59.70% +0.93%
+ Complexity 10595 10271 -324
============================================
Files 711 711
Lines 59050 55919 -3131
Branches 14307 13800 -507
============================================
- Hits 34705 33385 -1320
+ Misses 19752 18148 -1604
+ Partials 4593 4386 -207
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| private Map<ClaimMapping, String> userAttributes; | ||
| private Map<ClaimMapping, String> mappedRemoteClaims; | ||
| private String impersonator; | ||
| private String sessionContextIdentifier; |
There was a problem hiding this comment.
I think this could lead to session deserialization issues. Could you take a look? @SujanSanjula96 may have more context.
Proposed changes in this pull request
$subject
Issues: wso2/product-is#27473
The isk claim was absent from ID tokens issued via the Device Code grant when App Native Authentication was enabled.
Root cause: The session context identifier was never propagated through the Device Code flow's cache pipeline.
DeviceAuthorizationGrantCacheEntryhad nosessionContextIdentifierfield, so it was dropped when user attributes were cached after device authorization.AccessTokenIssuer.getAuthzGrantCacheEntryFromDeviceCode()did not copysessionContextIdentifierwhen convertingDeviceAuthorizationGrantCacheEntrytoAuthorizationGrantCacheEntry.SESSION_IDENTIFIERproperty was never set onOAuthTokenReqMessageContextbefore ID token building, so DefaultIDTokenBuilder's fallback lookup also returned null on the first token request.Summary by CodeRabbit