本文整理汇总了Java中org.wso2.carbon.user.core.UserStoreManager类的典型用法代码示例。如果您正苦于以下问题:Java UserStoreManager类的具体用法?Java UserStoreManager怎么用?Java UserStoreManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserStoreManager类属于org.wso2.carbon.user.core包,在下文中一共展示了UserStoreManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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));
}
}
示例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");
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}