Skip to content
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

Improve organization SSO check. #267

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,10 @@ protected void postAuthenticate(MessageContext messageContext, AuthenticationRes
AuthenticatedUser authenticatedUser;
if (user instanceof AuthenticatedUser) {
authenticatedUser = (AuthenticatedUser) user;
// For B2B organization users, set the user ID which is set as username in user object.
if (authenticatedUser.isFederatedUser() && StringUtils.isNotEmpty(authorizedOrganization)) {
/* For users whose identity is managed in an organization, will be authenticated using the
organization SSO. As being a federated login user, the username is populated with
corresponding user ID. */
if (authenticatedUser.isOrganizationUser()) {
String userName = MultitenantUtils.getTenantAwareUsername(authenticatedUser.getUserName());
userName = UserCoreUtil.removeDomainFromName(userName);
PrivilegedCarbonContext.getThreadLocalCarbonContext().setUserId(userName);
Expand All @@ -146,7 +148,7 @@ protected void postAuthenticate(MessageContext messageContext, AuthenticationRes
}

if (StringUtils.isNotEmpty(authorizedOrganization)) {
// Set the user's resident organization if user is accessing an organization
// Set the user's resident organization in the carbon context if user is accessing an organization
PrivilegedCarbonContext.getThreadLocalCarbonContext()
.setUserResidentOrganizationId(userResidentOrganization);
if (((AuthenticatedUser) user).isFederatedUser()) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@
<org.wso2.carbon.identity.cors.valve.version>${project.version}</org.wso2.carbon.identity.cors.valve.version>

<!--Carbon identity version-->
<identity.framework.version>5.25.652</identity.framework.version>
<identity.framework.version>7.0.46</identity.framework.version>
<carbon.identity.package.import.version.range>[5.17.8, 8.0.0)</carbon.identity.package.import.version.range>

<org.wso2.carbon.identity.oauth.version>6.11.168</org.wso2.carbon.identity.oauth.version>
Expand Down
Loading