-
Notifications
You must be signed in to change notification settings - Fork 379
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
Extract only shared roles from the user's role list when login to a shared app #2703
base: master
Are you sure you want to change the base?
Extract only shared roles from the user's role list when login to a shared app #2703
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2703 +/- ##
============================================
- Coverage 56.54% 56.53% -0.02%
- Complexity 8543 8555 +12
============================================
Files 654 654
Lines 48522 48607 +85
Branches 10131 10144 +13
============================================
+ Hits 27436 27479 +43
- Misses 17172 17228 +56
+ Partials 3914 3900 -14
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
...arbon.identity.oauth/src/main/java/org/wso2/carbon/identity/openidconnect/OIDCClaimUtil.java
Outdated
Show resolved
Hide resolved
...arbon.identity.oauth/src/main/java/org/wso2/carbon/identity/openidconnect/OIDCClaimUtil.java
Outdated
Show resolved
Hide resolved
2d456eb
to
84abe2b
Compare
...ity.oauth.endpoint/src/main/java/org/wso2/carbon/identity/oauth/endpoint/util/ClaimUtil.java
Outdated
Show resolved
Hide resolved
...ity.oauth.endpoint/src/main/java/org/wso2/carbon/identity/oauth/endpoint/util/ClaimUtil.java
Outdated
Show resolved
Hide resolved
84abe2b
to
64415f6
Compare
For the ID token is this properly handled ? Hope this is the place Line 512 in 07f4172
|
PR builder started |
PR builder completed |
List<String> userRoles) throws FrameworkException { | ||
|
||
List<String> rolesAssociatedWithApp = new ArrayList<>(); | ||
if (CollectionUtils.isNotEmpty(userRoles)) { |
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 refactor the code for better readbility.
Ex:
if (CollectionUtils.isEmpty(userRoles)) {
return rolesAssociatedWithApp;
}
Check whether the application is a fragment application and if so, add only the shared roles | ||
to the user's role list. | ||
*/ | ||
if (serviceProvider.getSpProperties() != null && Arrays.stream(serviceProvider.getSpProperties()).anyMatch( |
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 apply the same comment for here also. Avoiding the code right shifting will increase the readability.
getRoleIdByName(removeInternalDomain(roleName), RoleConstants.ORGANIZATION, | ||
serviceProvider.getTenantDomain(), serviceProvider.getTenantDomain()); | ||
if (roleId != null) { | ||
Role role = OAuth2ServiceComponentHolder.getInstance().getRoleManagementServiceV2(). |
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.
We may not need to get the role object in order to decide whether this is shared role or not.
We can try to get the main role, if it exist it is a shared role.
What need to check is whether we have to db calls for both approaches or any approach is backed by cache.
Proposed changes in this pull request