-
Notifications
You must be signed in to change notification settings - Fork 374
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
Fix access token attributes for federated user #2647
Fix access token attributes for federated user #2647
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2647 +/- ##
============================================
- Coverage 56.54% 56.43% -0.12%
+ Complexity 8201 8189 -12
============================================
Files 632 632
Lines 46689 46377 -312
Branches 8353 8348 -5
============================================
- Hits 26400 26171 -229
+ Misses 16581 16484 -97
- Partials 3708 3722 +14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
PR builder started |
PR builder completed |
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.
Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/12271871336
oAuthServerConfiguration.when(OAuthServerConfiguration::getInstance) | ||
.thenReturn(oauthServerConfigurationMock); | ||
try (MockedStatic<OAuth2Util> oAuth2Util = mockStatic(OAuth2Util.class)) { | ||
oAuth2Util.when(() -> OAuth2Util.getAppInformationByClientId(any(), any())).thenReturn( |
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.
Let's change any to any(RequiredClass.class)
private static boolean isMultiValuedAttribute(String claimKey, String claimValue, String multiAttributeSeparator) { | ||
|
||
// Address claim contains multi attribute separator but its not a multi valued attribute. | ||
if (claimKey.equals(ADDRESS)) { |
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.
if (claimKey.equals(ADDRESS)) { | |
if (ADDRESS.equals(claimKey)) { |
* @return Tenant domain of the service provider. | ||
*/ | ||
public static String getServiceProviderTenantDomain(OAuthAuthzReqMessageContext requestMsgCtx) { | ||
String spTenantDomain = (String) requestMsgCtx.getProperty(MultitenantConstants.TENANT_DOMAIN); |
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.
add line after method signature.
throws OAuthSystemException, IdentityOAuth2Exception { | ||
// Map<"email", "[email protected]"> | ||
Map<String, Object> userClaimsInOIDCDialect; | ||
// Get any user attributes that were cached against the access token |
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.
// Get any user attributes that were cached against the access token | |
// Get all user attributes that were cached against the access token |
WDYT?
log.debug("Retrieving claims cached against authorization_code for user: " + | ||
requestMsgCtx.getAuthorizedUser()); | ||
} | ||
if (isEmpty(userAttributes)) { |
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.
line 749 also checking same condition right? this is getting repeated in this method please check
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.
here if userAttributes are empty we trying to get userAttributes 742, then after we check empty
closed with this : #2653 |
Proposed changes in this pull request
Previously JWTAccessTokenAttributesOIDCClaimHandler resolve attributes from the userstore level and JWT token will not contain Access Token attributes in the federation login flow. This PR improve the JWTAccessTokenAttributesOIDCClaimHandler to handle attributes of the federated user. Here we have move common methods from JWTAccessTokenAttributesOIDCClaimHandler and DefaultOIDCClaimCallbackHandler to OIDCClaimUtil.
Related Issues
When should this PR be merged
[Please describe any preconditions that need to be addressed before we
can merge this pull request.]
Follow up actions
[List any possible follow-up actions here; for instance, testing data
migrations, software that we need to install on staging and production
environments.]
Checklist (for reviewing)
General
Functionality
Code
Tests
Security
Documentation