-
Notifications
You must be signed in to change notification settings - Fork 550
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
Handle role extraction for a shared user in organization switching #5648
Handle role extraction for a shared user in organization switching #5648
Conversation
a16711f
to
37846e2
Compare
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/8777597715
...plication/authentication/framework/handler/approles/impl/AppAssociatedRolesResolverImpl.java
Outdated
Show resolved
Hide resolved
37846e2
to
165c054
Compare
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/8922502779
@@ -119,13 +122,60 @@ private String[] getAppAssociatedRolesForLocalUser(AuthenticatedUser authenticat | |||
Set<String> userRoleIds = getAllRolesOfLocalUser(authenticatedUser); | |||
List<RoleV2> rolesAssociatedWithApp = getRolesAssociatedWithApplication(applicationId, | |||
authenticatedUser.getTenantDomain()); | |||
if (StringUtils.isNotEmpty(authenticatedUser.getSharedUserId())) { |
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 can check whether isOrganizatioSwitchUser()
if (!isSharedUserAccessingSharedOrg(authenticatedUser)) { | ||
return; | ||
} |
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.
This logic looks redundant as we are invoking this method for organization switched users.
private boolean isSharedUserAccessingSharedOrg(AuthenticatedUser authenticatedUser) { | ||
|
||
return StringUtils.isNotEmpty(authenticatedUser.getUserSharedOrganizationId()) && | ||
StringUtils.isNotEmpty(authenticatedUser.getAccessingOrganization()) && | ||
StringUtils.equals(authenticatedUser.getUserSharedOrganizationId(), | ||
authenticatedUser.getAccessingOrganization()); | ||
} |
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 can remove this and add a new method
isOrganizationSwitchedUser()
if resident & accessing org are not equal, it is an organization switching.
Proposed changes in this pull request
sharedUserId
anduserSharedOrganizationId
params to theAuthenticatedUser
.When should this PR be merged