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..9f8287ca2 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; @@ -53,6 +54,7 @@ import java.util.List; import java.util.Optional; import java.util.stream.Collectors; + import javax.ws.rs.core.Response; import static org.wso2.carbon.identity.api.user.common.Constants.ERROR_CODE_DELIMITER; @@ -93,7 +95,14 @@ public SessionsDTO getSessionsBySessionId(User user, Integer limit, Integer offs String userId; if (isFederatedUser()) { - userId = getFederatedUserIdFromUser(user); + boolean isOrganizationSSOUser = StringUtils.isNotEmpty(PrivilegedCarbonContext.getThreadLocalCarbonContext() + .getUserResidentOrganizationId()); + // For organization SSO users, user ID resolve same as for a local user. + if (isOrganizationSSOUser) { + userId = getUserIdFromUser(user); + } else { + userId = getFederatedUserIdFromUser(user); + } } else { userId = getUserIdFromUser(user); } diff --git a/pom.xml b/pom.xml index 8119c1c96..89763ffe3 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