org.wso2.carbon.user.core.UserStoreManager Java Examples

The following examples show how to use org.wso2.carbon.user.core.UserStoreManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostGetRoleListOfUsersWithID(List<String> userIDs, Map<String, List<String>> rolesOfUsersMap,
                                              UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    List<String> userNamesList = ((AbstractUserStoreManager) userStoreManager).getUserNamesFromUserIDs(userIDs);

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostGetRoleListOfUsers(userNamesList.toArray(new String[0]), rolesOfUsersMap)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #2
Source File: CacheClearingUserOperationListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * This method is overridden to clear caches on doPostDeleteUserClaimValue operation
 *
 * @param userName         username
 * @param userStoreManager UserStoreManagerClass
 * @return Always Returns true, since no major effect on further procedures
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostDeleteUserClaimValue(String userName, UserStoreManager userStoreManager)
        throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Clearing entitlement cache on post delete user claim value operation for " +
                  "user " + userName);
    }
    // Always returns true since cache clearing failure does not make an effect on subsequent
    // User Operation Listeners
    clearCarbonAttributeCache();
    return true;
}
 
Example #3
Source File: DefaultProvisioningHandler.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
private void handleFederatedUserNameEqualsToSuperAdminUserName(UserRealm realm, String username,
                                                               UserStoreManager userStoreManager,
                                                               Collection<String> deletingRoles)
        throws UserStoreException, FrameworkException {
    if (userStoreManager.getRealmConfiguration().isPrimary()
            && username.equals(realm.getRealmConfiguration().getAdminUserName())) {
        if (log.isDebugEnabled()) {
            log.debug("Federated user's username is equal to super admin's username of local IdP.");
        }

        // Whether superadmin login without superadmin role is permitted
        if (deletingRoles
                .contains(realm.getRealmConfiguration().getAdminRoleName())) {
            if (log.isDebugEnabled()) {
                log.debug("Federated user doesn't have super admin role. Unable to sync roles, since" +
                        " super admin role cannot be unassigned from super admin user");
            }
            throw new FrameworkException(
                    "Federated user which having same username to super admin username of local IdP," +
                            " trying login without having super admin role assigned");
        }
    }
}
 
Example #4
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostAddInternalRoleWithID(String roleName, String[] userIDList, Permission[] permissions,
                                           UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String[] userNames = getUserNamesFromUserIDs(userIDList, (AbstractUserStoreManager) userStoreManager);

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostAddInternalRole(roleName, userNames, permissions, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #5
Source File: UserClaimsAuditLogger.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
private void logClaims(String userName, String action, UserStoreManager userStoreManager) {

        try {
            Map<String, String> loggableClaims = userStoreManager.getUserClaimValues(userName, loggableClaimURIs,
                    DEFAULT);
            if (MapUtils.isNotEmpty(loggableClaims)) {
                audit.info(String.format(AUDIT_MESSAGE, getUser(), action, userName, formatClaims(loggableClaims)));
            } else {
                if (log.isDebugEnabled()) {
                    log.debug("No claims are configured under the user : " + userName);
                }
            }
        } catch (UserStoreException e) {
            log.error("Error occurred while logging user claim changes.", e);
        }
    }
 
Example #6
Source File: UserMgtFailureAuditLogger.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onUpdateRoleListOfUserFailure(String errorCode, String errorMessage, String userName,
        String[] deletedRoles, String[] newRoles, UserStoreManager userStoreManager) {

    JSONObject dataObject = new JSONObject();
    if (ArrayUtils.isNotEmpty(deletedRoles)) {
        dataObject.put(ListenerUtils.DELETED_ROLES, new JSONArray(deletedRoles));
    }
    if (ArrayUtils.isNotEmpty(newRoles)) {
        dataObject.put(ListenerUtils.NEW_ROLES, new JSONArray(newRoles));
    }
    audit.warn(createAuditMessage(ListenerUtils.UPDATE_ROLES_OF_USER_ACTION,
            ListenerUtils.getEntityWithUserStoreDomain(userName, userStoreManager), dataObject, errorCode,
            errorMessage));

    return true;
}
 
Example #7
Source File: XMPPConfigurationService.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * Get the IM Address of an user to populate the IM field of XMPP Configuration page.
 *
 * @param userId
 * @return
 * @throws IdentityProviderException
 */
public String getUserIM(String userId) throws IdentityProviderException {
    String message = "Invalid parameters provided to hasXMPPSettings";
    validateInputParameters(new String[] { userId }, message);
    checkUserAuthorization(userId, "hasXMPPSettings");

    Map<String, String> claimValues = null;
    try {
        UserStoreManager userStore = AdminServicesUtil.getUserRealm().getUserStoreManager();
        String[] imClaim = { UserCoreConstants.ClaimTypeURIs.IM };
        claimValues = userStore.getUserClaimValues(userId, imClaim, UserCoreConstants.DEFAULT_PROFILE);
    } catch (UserStoreException | CarbonException e) {
        throw new IdentityProviderException("Failed to get claims for user " + userId);
    }

    if (claimValues.containsKey(UserCoreConstants.ClaimTypeURIs.IM)) {
        return claimValues.get(UserCoreConstants.ClaimTypeURIs.IM);
    } else {
        return null;
    }
}
 
Example #8
Source File: UserOperationsNotificationListener.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * Overridden to trigger Notification Sending module to send messages to registered modules
 * on doPostDeleteUserClaimValues
 *
 * @param username         Username of the deleted user
 * @param userStoreManager Instance of user store manager called
 * @return Always returns true, even if message sending fails there is no major effect on
 * further operations.
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostDeleteUserClaimValues(String username, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending user claim value update notification for user " + username);
    }
    sendNotification(EVENT_TYPE_PROFILE_UPDATE, username);
    // Returns true since no major effect on upcoming listeners
    return true;
}
 
Example #9
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreUpdateRoleListOfUser(String userName, String[] deletedRoles, String[] newRoles,
                                         UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPreUpdateRoleListOfUserWithID(userID, deletedRoles, newRoles, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #10
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreUpdateRoleListOfUserWithID(String userID, String[] deletedRoles, String[] newRoles,
                                               UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userName = getUserNameFromUserID(userID, (AbstractUserStoreManager) userStoreManager);
    if (userName == null) {
        return handleUserNameResolveFailure(userID, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPreUpdateRoleListOfUser(userName, deletedRoles, newRoles, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #11
Source File: CacheClearingUserOperationListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * This method is overridden to clear caches on doPostAddRole operation
 *
 * @param roleName         Name of the added role
 * @param userList         List of the users who got added the role
 * @param permissions      set of permissions
 * @param userStoreManager UserStoreManager instance got called
 * @return Always Returns true, since no major effect on further procedures
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostAddRole(String roleName, String[] userList, Permission[] permissions,
                             UserStoreManager userStoreManager) throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Clearing entitlement cache on post add role operation for role " +
                  roleName);
    }
    clearCarbonAttributeCache();
    // Always returns true since cache clearing failure does not make an effect on subsequent
    // User Operation Listeners
    return true;
}
 
Example #12
Source File: CacheClearingUserOperationListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * @param roleName         Old role name of the updating role
 * @param newRoleName      New role name of the updating role name
 * @param userStoreManager UserStoreManager instance got called
 * @return Always returns true since no major effect on further procedure.
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostUpdateRoleName(String roleName, String newRoleName,
                                    UserStoreManager userStoreManager) throws
                                                                       UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Clearing entitlement cache on post update role operation for role " +
                  roleName);
    }
    clearCarbonAttributeCache();
    // Always returns true since cache clearing failure does not make an effect on subsequent
    // User Operation Listeners
    return true;
}
 
Example #13
Source File: UserSessionTerminationListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostUpdateCredentialByAdmin(String username, Object credential, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    if (!IdentityMgtServiceDataHolder.getInstance().isUserSessionMappingEnabled()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Terminating all the active sessions of the password reset user: " + username);
    }

    terminateSessionsOfUser(username, userStoreManager);
    return true;
}
 
Example #14
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostUpdateRoleListOfUser(String userName, String[] deletedRoles, String[] newRoles,
                                          UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPostUpdateRoleListOfUserWithID(userID, deletedRoles, newRoles, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #15
Source File: UserOperationsNotificationListener.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
/**
 * Overridden to trigger Notification Sending module to send messages to registered modules
 * on doPostSetUserClaimValues
 *
 * @param username         username of user whose claim values are updated
 * @param claims           set of claims
 * @param profileName      profile name
 * @param userStoreManager instance of user store manager called
 * @return always returns true since no major effect on further operations
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostSetUserClaimValues(String username,
                                        Map<String, String> claims, String profileName,
                                        UserStoreManager userStoreManager)
        throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending user claim values update notification for user " + username);
    }
    sendNotification(EVENT_TYPE_PROFILE_UPDATE, username);
    // Returns true since no major effect on upcoming listeners
    return true;
}
 
Example #16
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostListUsersWithID(String filter, int limit, int offset, List<User> returnUsersList,
                                     UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    List<String> returnUserNamesList = returnUsersList.stream().map(User::getUsername).collect(Collectors.toList());

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostListUsers(filter, limit, offset, returnUserNamesList, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #17
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostGetUserList(Condition condition, String domain, String profileName, int limit, int offset,
                                 String sortBy, String sortOrder, String[] returnUserNameList,
                                 UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    List<User> returnUsersList = getUsersFromNames((AbstractUserStoreManager) userStoreManager,
            Arrays.asList(returnUserNameList));

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPostGetUserListWithID(condition, domain, profileName, limit, offset, sortBy, sortOrder,
                            returnUsersList, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #18
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostSetUserClaimValueWithID(String userID, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userName = getUserNameFromUserID(userID, (AbstractUserStoreManager) userStoreManager);
    if (userName == null) {
        return handleUserNameResolveFailure(userID, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostSetUserClaimValue(userName, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #19
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostGetUserClaimValues(String userName, String[] claims, String profileName,
                                        Map<String, String> claimMap, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPostGetUserClaimValuesWithID(userID, claims, profileName, claimMap, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #20
Source File: UserStoreActionListener.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreUpdateRoleListOfUser(String userName, String[] deletedRoles, String[] newRoles, UserStoreManager
        userStoreManager) throws UserStoreException {
    if (!isEnable() || isCalledViaIdentityMgtListners()) {
        return true;
    }
    try {
        UpdateUserRolesWFRequestHandler updateUserRolesWFRequestHandler = new UpdateUserRolesWFRequestHandler();
        String domain = userStoreManager.getRealmConfiguration().getUserStoreProperty(UserCoreConstants.RealmConfig
                                                                                              .PROPERTY_DOMAIN_NAME);

        int tenantId = userStoreManager.getTenantId() ;
        String currentUser = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername();
        PrivilegedCarbonContext.startTenantFlow();
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setTenantId(tenantId, true);
        PrivilegedCarbonContext.getThreadLocalCarbonContext().setUsername(currentUser);

        return updateUserRolesWFRequestHandler.startUpdateUserRolesFlow(domain, userName, deletedRoles, newRoles);
    } catch (WorkflowException e) {
        // Sending e.getMessage() since it is required to give error message to end user.
        throw new UserStoreException(e.getMessage(), e);
    } finally {
        PrivilegedCarbonContext.endTenantFlow();
    }
}
 
Example #21
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostDeleteUserClaimValue(String userName, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);

    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPostDeleteUserClaimValueWithID(userID, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #22
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostUpdateCredentialByAdminWithID(String userID, Object credential,
                                                   UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userName = getUserNameFromUserID(userID, (AbstractUserStoreManager) userStoreManager);
    if (userName == null) {
        return handleUserNameResolveFailure(userID, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPostUpdateCredentialByAdmin(userName, credential, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #23
Source File: IdentityUserNameResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreUpdateCredentialByAdminWithID(String userID, Object newCredential,
                                                  UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userName = getUserNameFromUserID(userID, (AbstractUserStoreManager) userStoreManager);
    if (userName == null) {
        return handleUserNameResolveFailure(userID, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!listener.doPreUpdateCredentialByAdmin(userName, newCredential, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #24
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreDeleteUserClaimValue(String userName, String claimURI, String profileName,
                                         UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPreDeleteUserClaimValueWithID(userID, claimURI, profileName, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #25
Source File: UserRealmProxy.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
private void mapEntityName(String entityName, FlaggedName fName,
                           UserStoreManager userStoreManager) {
    if (entityName.contains(UserCoreConstants.SHARED_ROLE_TENANT_SEPERATOR)) {
        String[] nameAndDn = entityName.split(UserCoreConstants.SHARED_ROLE_TENANT_SEPERATOR);
        fName.setItemName(nameAndDn[0]);
        fName.setDn(nameAndDn[1]);

        // TODO remove abstract user store
        fName.setShared(((AbstractUserStoreManager) userStoreManager).isOthersSharedRole(entityName));
        if (fName.isShared()) {
            fName.setItemDisplayName(UserCoreConstants.SHARED_ROLE_TENANT_SEPERATOR +
                    fName.getItemName());
        }

    } else {
        fName.setItemName(entityName);
    }

}
 
Example #26
Source File: IdentityOpenIDUserEventListener.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPreDeleteUser(String userName, UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Clearing OpenID related information of the user : " + userName);
    }

    try {
        int tenantId = CarbonContext.getThreadLocalCarbonContext().getTenantId();
        deleteUsersRPs(userName, tenantId);
    } catch (IdentityException e) {
        throw new UserStoreException("Error occurred while deleting RP entries in the DB related to the user", e);
    }
    return true;
}
 
Example #27
Source File: UserMgtAuditLogger.java    From carbon-identity with Apache License 2.0 6 votes vote down vote up
public boolean doPostAddUser(String userName, Object credential, String[] roleList, Map<String, String> claims,
                             String profile, UserStoreManager userStoreManager) throws UserStoreException {

    if(!isEnable()) {
        return true;
    }

    StringBuilder builder = new StringBuilder();
    if (roleList != null) {
        for (int i = 0; i < roleList.length; i++) {
            builder.append(roleList[i] + ",");
        }
    }
    audit.info(String.format(AUDIT_MESSAGE, getUser(), "Add User", userName, "Roles :"
            + builder.toString(), SUCCESS));
    return true;
}
 
Example #28
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostSetUserClaimValue(String userName, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName);
    if (userID == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPostSetUserClaimValueWithID(userID, userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #29
Source File: IdentityUserIdResolverListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
@Override
public boolean doPostAddUser(String userName, Object credential, String[] roleList, Map<String, String> claims,
                             String profile, UserStoreManager userStoreManager) throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    User user = ((AbstractUserStoreManager) userStoreManager).getUser(null, userName);
    if (user == null) {
        return handleUserIDResolveFailure(userName, userStoreManager);
    }

    for (UserOperationEventListener listener : getUserStoreManagerListeners()) {
        if (isNotAResolverListener(listener)) {
            if (!((UniqueIDUserOperationEventListener) listener)
                    .doPostAddUserWithID(user, credential, roleList, claims, profile,
                            userStoreManager)) {
                return false;
            }
        }
    }

    return true;
}
 
Example #30
Source File: UserOperationsNotificationListener.java    From carbon-identity-framework with Apache License 2.0 6 votes vote down vote up
/**
 * Overridden to trigger Notification Sending module to send messages to registered modules
 * on doPostDeleteUserClaimValues
 *
 * @param username         Username of the deleted user
 * @param userStoreManager Instance of user store manager called
 * @return Always returns true, even if message sending fails there is no major effect on
 * further operations.
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostDeleteUserClaimValues(String username, UserStoreManager userStoreManager)
        throws UserStoreException {

    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending user claim value update notification for user " + username);
    }
    sendNotification(EVENT_TYPE_PROFILE_UPDATE, username);
    // Returns true since no major effect on upcoming listeners
    return true;
}