diff --git a/components/org.wso2.carbon.identity.api.user.session/org.wso2.carbon.identity.api.user.session.v1/src/main/java/org/wso2/carbon/identity/rest/api/user/session/v1/core/SessionManagementService.java b/components/org.wso2.carbon.identity.api.user.session/org.wso2.carbon.identity.api.user.session.v1/src/main/java/org/wso2/carbon/identity/rest/api/user/session/v1/core/SessionManagementService.java index 6815fa344..fba13ea82 100644 --- a/components/org.wso2.carbon.identity.api.user.session/org.wso2.carbon.identity.api.user.session.v1/src/main/java/org/wso2/carbon/identity/rest/api/user/session/v1/core/SessionManagementService.java +++ b/components/org.wso2.carbon.identity.api.user.session/org.wso2.carbon.identity.api.user.session.v1/src/main/java/org/wso2/carbon/identity/rest/api/user/session/v1/core/SessionManagementService.java @@ -21,6 +21,7 @@ import org.apache.commons.lang.StringUtils; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.identity.api.user.common.error.APIError; import org.wso2.carbon.identity.api.user.common.error.ErrorResponse; import org.wso2.carbon.identity.api.user.common.function.UserToUniqueId; @@ -368,6 +369,11 @@ private String getUserIdFromUser(User user) { private String getFederatedUserIdFromUser(User user) { + String userResidentOrg = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserResidentOrganizationId(); + // The organization SSO user's ID is correctly set in the carbon context. + if (StringUtils.isNotEmpty(userResidentOrg)) { + return PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserId(); + } if (!IdentityUtil.threadLocalProperties.get().containsKey(IDP_NAME)) { if (log.isDebugEnabled()) { log.debug("Idp name cannot be found in thread local."); diff --git a/pom.xml b/pom.xml index 6a9f6a513..6e3a247a8 100644 --- a/pom.xml +++ b/pom.xml @@ -420,7 +420,7 @@ 2.3.1.wso2v1 1.4 1.2.4 - 4.9.0 + 4.9.17 1.8.73 5.25.380 5.3.7