• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java UserStoreManager类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.wso2.carbon.user.core.UserStoreManager的典型用法代码示例。如果您正苦于以下问题:Java UserStoreManager类的具体用法?Java UserStoreManager怎么用?Java UserStoreManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



UserStoreManager类属于org.wso2.carbon.user.core包,在下文中一共展示了UserStoreManager类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: updateUserWithNewRoleSet

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
private void updateUserWithNewRoleSet(String username, UserStoreManager userStoreManager, String[] newRoles,
                                      Collection<String> addingRoles, Collection<String> deletingRoles)
        throws UserStoreException {
    if (log.isDebugEnabled()) {
        log.debug("Deleting roles : "
                  + Arrays.toString(deletingRoles.toArray(new String[deletingRoles.size()]))
                  + " and Adding roles : "
                  + Arrays.toString(addingRoles.toArray(new String[addingRoles.size()])));
    }
    userStoreManager.updateRoleListOfUser(username, deletingRoles.toArray(new String[deletingRoles
                                                  .size()]),
                                          addingRoles.toArray(new String[addingRoles.size()]));
    if (log.isDebugEnabled()) {
        log.debug("Federated user: " + username
                  + " is updated by authentication framework with roles : "
                  + Arrays.toString(newRoles));
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:19,代码来源:DefaultProvisioningHandler.java


示例2: handleFederatedUserNameEqualsToSuperAdminUserName

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
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");
        }
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:24,代码来源:DefaultProvisioningHandler.java


示例3: getRolesToAdd

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
private Collection<String> getRolesToAdd(UserStoreManager userStoreManager, String[] newRoles)
        throws UserStoreException {

    List<String> rolesToAdd = Arrays.asList(newRoles);
    List<String> updatedRolesToAdd = new ArrayList<>();

    // Make Internal domain name case insensitive
    for (String role : rolesToAdd) {
        if (StringUtils.containsIgnoreCase(role, UserCoreConstants.INTERNAL_DOMAIN +
                CarbonConstants.DOMAIN_SEPARATOR)) {
            updatedRolesToAdd.add(UserCoreConstants.INTERNAL_DOMAIN + CarbonConstants.DOMAIN_SEPARATOR +
                    UserCoreUtil.removeDomainFromName(role));
        } else {
            updatedRolesToAdd.add(role);
        }
    }
    List<String> allExistingRoles = removeDomainFromNamesExcludeInternal(
            Arrays.asList(userStoreManager.getRoleNames()), userStoreManager.getTenantId());
    updatedRolesToAdd.retainAll(allExistingRoles);
    return updatedRolesToAdd;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:DefaultProvisioningHandler.java


示例4: doPostDeleteUser

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * TThis method is overridden to clear caches on doPostDeleteUser operation
 *
 * @param userName         username
 * @param userStoreManager UserStoreManagerClass
 * @return Returns true always since no major effect on further procedures
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostDeleteUser(String userName, UserStoreManager userStoreManager) throws
                                                                                    UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Clearing entitlement cache on post delete user operation for user " +
                  userName);
    }
    clearCarbonAttributeCache();
    // Always returns true since cache clearing failure does not make an effect on subsequent
    // User Operation Listeners
    return true;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:CacheClearingUserOperationListener.java


示例5: doPostSetUserClaimValue

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * This method is overridden to clear caches on doPostSetUserClaimValue operation
 *
 * @param userName         username
 * @param userStoreManager UserStoreManagerClass
 * @return Returns true always since no major effect on further procedures
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostSetUserClaimValue(String userName, UserStoreManager userStoreManager)
        throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Clearing entitlement cache on post set 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;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:CacheClearingUserOperationListener.java


示例6: doPostSetUserClaimValues

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * This method is overridden to clear caches on doPostSetUserClaimValues operation
 *
 * @param userName         Username of subjected user for claim updating
 * @param claims           Set of updated claims
 * @param profileName      Name of the profile
 * @param userStoreManager UserStoreManager instance got 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("Clearing entitlement cache on post set user claim values operation for " +
                  "user " + userName);
    }
    // Always returns true since cache clearing failure does not make an effect on subsequent
    // User Operation Listeners
    clearCarbonAttributeCache();
    return true;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:CacheClearingUserOperationListener.java


示例7: doPostDeleteUserClaimValues

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * TThis method is overridden to clear caches on doPostDeleteUserClaimValues operation
 *
 * @param userName         username
 * @param userStoreManager UserStoreManagerClass
 * @return Returns true always since no major effect on further procedures
 * @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("Clearing entitlement cache on post delete user claim values operation for " +
                  "user " + userName);
    }
    // Always returns true since cache clearing failure does not make an effect on subsequent
    // User Operation Listeners
    clearCarbonAttributeCache();
    return true;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:26,代码来源:CacheClearingUserOperationListener.java


示例8: doPostDeleteUserClaimValue

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:CacheClearingUserOperationListener.java


示例9: doPostAddRole

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:27,代码来源:CacheClearingUserOperationListener.java


示例10: doPostDeleteRole

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * This method is overridden to clear caches on doPostDeleteRole operation
 *
 * @param roleName         Deleted role name
 * @param userStoreManager UserStoreManagerClass
 * @return Always Returns true, since no major effect on further procedures
 * @throws org.wso2.carbon.user.core.UserStoreException
 */
@Override
public boolean doPostDeleteRole(String roleName, UserStoreManager userStoreManager) throws
                                                                                    UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Clearing entitlement cache on post delete 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;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:CacheClearingUserOperationListener.java


示例11: doPostUpdateRoleName

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * @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;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:CacheClearingUserOperationListener.java


示例12: isUserStoreCaseSensitive

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * Check the case sensitivity of the user store.
 *
 * @param userStoreDomain user store domain
 * @param tenantId        tenant id of the user store
 * @return
 */
public static boolean isUserStoreCaseSensitive(String userStoreDomain, int tenantId) {

    boolean isUsernameCaseSensitive = true;
    if (tenantId == MultitenantConstants.INVALID_TENANT_ID) {
        //this is to handle federated scenarios
        return true;
    }
    try {
        org.wso2.carbon.user.core.UserStoreManager userStoreManager = (org.wso2.carbon.user.core
                .UserStoreManager) IdentityTenantUtil.getRealmService()
                .getTenantUserRealm(tenantId).getUserStoreManager();
        org.wso2.carbon.user.core.UserStoreManager userAvailableUserStoreManager = userStoreManager
                .getSecondaryUserStoreManager(userStoreDomain);
        return isUserStoreCaseSensitive(userAvailableUserStoreManager);
    } catch (UserStoreException e) {
        if (log.isDebugEnabled()) {
            log.debug("Error while reading user store property CaseInsensitiveUsername. Considering as case " +
                    "sensitive.");
        }
    }
    return isUsernameCaseSensitive;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:30,代码来源:IdentityUtil.java


示例13: unlockAdmin

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * This method will unlock the admin account
 */
private void unlockAdmin() {
    String adminUserName =
            IdentityMgtServiceComponent.getRealmService().getBootstrapRealmConfiguration().getAdminUserName();
    try {
        if (isEnable()) {
            UserStoreManager userStoreMng = IdentityMgtServiceComponent.getRealmService()
                    .getBootstrapRealm().getUserStoreManager();
            Map<String, String> claimMap = new HashMap<String, String>();
            claimMap.put(UserIdentityDataStore.ACCOUNT_LOCK, Boolean.toString(false));
            claimMap.put(UserIdentityDataStore.ACCOUNT_DISABLED, Boolean.toString(false));
            // Directly "do" method of this listener is called because at the time of this execution,
            // this listener or any other listener may have no registered.
            doPreSetUserClaimValues(adminUserName, claimMap, null, userStoreMng);
        }
    } catch (UserStoreException e) {
        log.error("Error while unlocking admin account", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:22,代码来源:IdentityMgtEventListener.java


示例14: doPostDeleteUserClaimValues

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:26,代码来源:UserOperationsNotificationListener.java


示例15: doPostDeleteUserClaimValue

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * 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 doPostDeleteUserClaimValue(String username, UserStoreManager userStoreManager)
        throws UserStoreException {

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

    if (log.isDebugEnabled()) {
        log.debug("Sending user delete update notification for user " + username);
    }
    sendNotification(EVENT_TYPE_PROFILE_UPDATE, username);
    // Returns true since no major effect on upcoming listeners
    return true;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:27,代码来源:UserOperationsNotificationListener.java


示例16: doPostUpdateRoleListOfUser

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * Overridden to trigger Notification Sending module to send messages to registered modules
 * on PostUpdateRoleListOfUser
 *
 * @param username         Username of role updated user
 * @param deletedRoles     List of roles deleted
 * @param newRoles         list of roles added
 * @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
 */
public boolean doPostUpdateRoleListOfUser(String username,
                                          String[] deletedRoles, String[] newRoles,
                                          UserStoreManager userStoreManager)
        throws UserStoreException {
    if (!isEnable()) {
        return true;
    }

    if (log.isDebugEnabled()) {
        log.debug("Sending user role list update notification for user " + username);
    }
    sendNotification(EVENT_TYPE_ROLE_UPDATE, username);
    // Returns true since no major effect on upcoming listeners
    return true;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:27,代码来源:UserOperationsNotificationListener.java


示例17: doPostSetUserClaimValues

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:UserOperationsNotificationListener.java


示例18: mapEntityName

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
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);
    }

}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:20,代码来源:UserRealmProxy.java


示例19: doPostAddUser

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
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;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:18,代码来源:UserMgtAuditLogger.java


示例20: doPreDeleteUser

import org.wso2.carbon.user.core.UserStoreManager; //导入依赖的package包/类
/**
 * Delete federated user account associations a user has upon deleting the local user account.
 *
 * @param userName
 * @param userStoreManager
 * @return
 * @throws UserStoreException
 */
@Override
public boolean doPreDeleteUser(String userName,
        UserStoreManager userStoreManager) throws UserStoreException {

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

    String userStoreDomain = UserCoreUtil.getDomainName(userStoreManager.getRealmConfiguration());
    if (StringUtils.isBlank(userStoreDomain)) {
        userStoreDomain = UserCoreConstants.PRIMARY_DEFAULT_DOMAIN_NAME;
    }
    int tenantId = userStoreManager.getTenantId();

    if (log.isDebugEnabled()) {
        log.debug("doPreDeleteUser method executed in ProfileMgtEventListener for user:" +
                getFullQualifiedUsername(userName, userStoreDomain, IdentityTenantUtil.getTenantDomain(tenantId)));
    }

    deleteFederatedIdpAccountAssociations(userName, userStoreDomain, tenantId);
    return true;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:31,代码来源:ProfileMgtEventListener.java



注:本文中的org.wso2.carbon.user.core.UserStoreManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RequestContextHolder类代码示例发布时间:2022-05-22
下一篇:
Java FileListIterator类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap