Search in sources :

Example 1 with UniqueIDUserOperationEventListener

use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.

the class IdentityUserIdResolverListener method doPostUpdateUserListOfInternalRole.

@Override
public boolean doPostUpdateUserListOfInternalRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    String[] deletedUserIDs;
    try {
        deletedUserIDs = getUserIdsFromUserNames(deletedUsers, (AbstractUserStoreManager) userStoreManager);
    } catch (UserStoreException e) {
        // supported user store.
        if (log.isDebugEnabled()) {
            log.debug(e.getMessage(), e);
        }
        return true;
    }
    String[] newUserIDs;
    try {
        newUserIDs = getUserIdsFromUserNames(newUsers, (AbstractUserStoreManager) userStoreManager);
    } catch (UserStoreException e) {
        // supported user store.
        if (log.isDebugEnabled()) {
            log.debug(e.getMessage(), e);
        }
        return true;
    }
    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener).doPostUpdateUserListOfInternalRoleWithID(roleName, deletedUserIDs, newUserIDs, userStoreManager)) {
                return false;
            }
        }
    }
    return true;
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UniqueIDUserOperationEventListener(org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener) AbstractIdentityUserOperationEventListener(org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener) UserStoreException(org.wso2.carbon.user.core.UserStoreException) AbstractUserStoreManager(org.wso2.carbon.user.core.common.AbstractUserStoreManager)

Example 2 with UniqueIDUserOperationEventListener

use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.

the class IdentityUserIdResolverListener method doPostGetUsersClaimValues.

@Override
public boolean doPostGetUsersClaimValues(String[] userNames, String[] claims, String profileName, UserClaimSearchEntry[] userClaimSearchEntries, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    List<String> userIDsList = ((AbstractUserStoreManager) userStoreManager).getUserIDsFromUserNames(Arrays.asList(getDomainLessNames(userNames)));
    List<String> claimsList = Arrays.asList(claims);
    List<UniqueIDUserClaimSearchEntry> uniqueIDUserClaimSearchEntriesList = ((AbstractUserStoreManager) userStoreManager).getUniqueIDUserClaimSearchEntries(userClaimSearchEntries);
    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener).doPostGetUsersClaimValuesWithID(userIDsList, claimsList, profileName, uniqueIDUserClaimSearchEntriesList, userStoreManager)) {
                return false;
            }
        }
    }
    return true;
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UniqueIDUserOperationEventListener(org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener) AbstractIdentityUserOperationEventListener(org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener) UniqueIDUserClaimSearchEntry(org.wso2.carbon.user.core.model.UniqueIDUserClaimSearchEntry) AbstractUserStoreManager(org.wso2.carbon.user.core.common.AbstractUserStoreManager)

Example 3 with UniqueIDUserOperationEventListener

use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.

the class IdentityUserIdResolverListener method doPreUpdateUserListOfRole.

@Override
public boolean doPreUpdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    String[] deletedUserIDs;
    try {
        deletedUserIDs = getUserIdsFromUserNames(deletedUsers, (AbstractUserStoreManager) userStoreManager);
    } catch (UserStoreException e) {
        // supported user store.
        if (log.isDebugEnabled()) {
            log.debug(e.getMessage(), e);
        }
        return true;
    }
    String[] newUserIDs;
    try {
        newUserIDs = getUserIdsFromUserNames(newUsers, (AbstractUserStoreManager) userStoreManager);
    } catch (UserStoreException e) {
        // supported user store.
        if (log.isDebugEnabled()) {
            log.debug(e.getMessage(), e);
        }
        return true;
    }
    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener).doPreUpdateUserListOfRoleWithID(roleName, deletedUserIDs, newUserIDs, userStoreManager)) {
                return false;
            }
        }
    }
    return true;
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UniqueIDUserOperationEventListener(org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener) AbstractIdentityUserOperationEventListener(org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener) UserStoreException(org.wso2.carbon.user.core.UserStoreException) AbstractUserStoreManager(org.wso2.carbon.user.core.common.AbstractUserStoreManager)

Example 4 with UniqueIDUserOperationEventListener

use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.

the class IdentityUserIdResolverListener method doPostUpdateUserListOfRole.

@Override
public boolean doPostUpdateUserListOfRole(String roleName, String[] deletedUsers, String[] newUsers, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    String[] deletedUserIDs;
    try {
        deletedUserIDs = getUserIdsFromUserNames(deletedUsers, (AbstractUserStoreManager) userStoreManager);
    } catch (UserStoreException e) {
        // supported user store.
        if (log.isDebugEnabled()) {
            log.debug(e.getMessage(), e);
        }
        return true;
    }
    String[] newUserIDs;
    try {
        newUserIDs = getUserIdsFromUserNames(newUsers, (AbstractUserStoreManager) userStoreManager);
    } catch (UserStoreException e) {
        // supported user store.
        if (log.isDebugEnabled()) {
            log.debug(e.getMessage(), e);
        }
        return true;
    }
    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener).doPostUpdateUserListOfRoleWithID(roleName, deletedUserIDs, newUserIDs, userStoreManager)) {
                return false;
            }
        }
    }
    return true;
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UniqueIDUserOperationEventListener(org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener) AbstractIdentityUserOperationEventListener(org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener) UserStoreException(org.wso2.carbon.user.core.UserStoreException) AbstractUserStoreManager(org.wso2.carbon.user.core.common.AbstractUserStoreManager)

Example 5 with UniqueIDUserOperationEventListener

use of org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener in project carbon-identity-framework by wso2.

the class IdentityUserIdResolverListener method doPostAuthenticate.

@Override
public boolean doPostAuthenticate(String userName, boolean authenticated, UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }
    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }
    AuthenticationResult authenticationResult;
    if (authenticated) {
        authenticationResult = new AuthenticationResult(AuthenticationResult.AuthenticationStatus.SUCCESS);
        User user = ((AbstractUserStoreManager) userStoreManager).getUser(userID, userName);
        authenticationResult.setAuthenticatedUser(user);
    } else {
        authenticationResult = new AuthenticationResult(AuthenticationResult.AuthenticationStatus.FAIL);
    }
    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener).doPostAuthenticateWithID(userID, authenticationResult, userStoreManager)) {
                return false;
            }
        }
    }
    return true;
}
Also used : UserOperationEventListener(org.wso2.carbon.user.core.listener.UserOperationEventListener) UniqueIDUserOperationEventListener(org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener) AbstractIdentityUserOperationEventListener(org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener) User(org.wso2.carbon.user.core.common.User) AbstractUserStoreManager(org.wso2.carbon.user.core.common.AbstractUserStoreManager) AuthenticationResult(org.wso2.carbon.user.core.common.AuthenticationResult)

Aggregations

AbstractIdentityUserOperationEventListener (org.wso2.carbon.identity.core.AbstractIdentityUserOperationEventListener)7 AbstractUserStoreManager (org.wso2.carbon.user.core.common.AbstractUserStoreManager)7 UniqueIDUserOperationEventListener (org.wso2.carbon.user.core.listener.UniqueIDUserOperationEventListener)7 UserOperationEventListener (org.wso2.carbon.user.core.listener.UserOperationEventListener)7 UserStoreException (org.wso2.carbon.user.core.UserStoreException)4 AuthenticationResult (org.wso2.carbon.user.core.common.AuthenticationResult)1 User (org.wso2.carbon.user.core.common.User)1 UniqueIDUserClaimSearchEntry (org.wso2.carbon.user.core.model.UniqueIDUserClaimSearchEntry)1