org.wso2.carbon.user.core.common.AbstractUserStoreManager Java Examples
The following examples show how to use
org.wso2.carbon.user.core.common.AbstractUserStoreManager.
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: UserRealmProxy.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
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 #2
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostGetUserClaimValue(String userName, String claim, List<String> claimValue, 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) .doPostGetUserClaimValueWithID(userID, claim, claimValue, profileName, userStoreManager)) { return false; } } } return true; }
Example #3
Source File: ApplicationManagementServiceImpl.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
private void assignApplicationRole(String applicationName, String username) throws IdentityApplicationManagementException { String roleName = getAppRoleName(applicationName); String[] newRoles = {roleName}; try { // assign new application role to the user. UserRealm realm = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUserRealm(); if (realm != null) { if (((AbstractUserStoreManager) realm.getUserStoreManager()).isUserInRole(username, roleName)) { if (log.isDebugEnabled()) { log.debug("The user: " + username + " is already having the role: " + roleName); } } else { realm.getUserStoreManager().updateRoleListOfUser(username, null, newRoles); if (log.isDebugEnabled()) { log.debug("Assigning application role : " + roleName + " to the user : " + username); } } } } catch (UserStoreException e) { throw new IdentityApplicationManagementException("Error while assigning application role: " + roleName + " to the user: " + username, e); } }
Example #4
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPreGetUserClaimValue(String userName, String claim, 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) .doPreGetUserClaimValueWithID(userID, claim, profileName, userStoreManager)) { return false; } } } return true; }
Example #5
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@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 #6
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@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 #7
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPreGetUserClaimValues(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) .doPreGetUserClaimValuesWithID(userID, claims, profileName, claimMap, userStoreManager)) { return false; } } } return true; }
Example #8
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPreGetUserList(String claimUri, String claimValue, int limit, int offset, List<String> returnUserNameList, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } List<User> returnUsersList = getUsersFromNames((AbstractUserStoreManager) userStoreManager, returnUserNameList); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!((UniqueIDUserOperationEventListener) listener) .doPreGetUserListWithID(claimUri, claimValue, limit, offset, returnUsersList, userStoreManager)) { return false; } } } return true; }
Example #9
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostGetUserList(String claimUri, String claimValue, List<String> returnUserNameList, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } List<User> returnUsersList = getUsersFromNames((AbstractUserStoreManager) userStoreManager, returnUserNameList); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!((UniqueIDUserOperationEventListener) listener) .doPostGetUserListWithID(claimUri, claimValue, returnUsersList, userStoreManager)) { return false; } } } return true; }
Example #10
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostGetUserList(String claimUri, String claimValue, List<String> returnUserNameList, int limit, int offset, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } List<User> returnUsersList = getUsersFromNames((AbstractUserStoreManager) userStoreManager, returnUserNameList); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!((UniqueIDUserOperationEventListener) listener) .doPostGetUserListWithID(claimUri, claimValue, returnUsersList, limit, offset, userStoreManager)) { return false; } } } return true; }
Example #11
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@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 #12
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostGetPaginatedUserList(String claimUri, String claimValue, List<String> returnUserNameList, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } List<User> returnUsersList = getUsersFromNames((AbstractUserStoreManager) userStoreManager, returnUserNameList); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!((UniqueIDUserOperationEventListener) listener) .doPostGetPaginatedUserListWithID(claimUri, claimValue, returnUsersList, userStoreManager)) { return false; } } } return true; }
Example #13
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostGetUserListOfRole(String roleName, String[] returnUserNameList, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } List<User> returnUsersList = getUsersFromNames((AbstractUserStoreManager) userStoreManager, Arrays.asList(getDomainLessNames(returnUserNameList))); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!((UniqueIDUserOperationEventListener) listener) .doPostGetUserListOfRoleWithID(roleName, returnUsersList, userStoreManager)) { return false; } } } return true; }
Example #14
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostGetRoleListOfUsers(String[] userNames, Map<String, List<String>> rolesOfUsersMap, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } List<String> userIDsList = ((AbstractUserStoreManager) userStoreManager) .getUserIDsFromUserNames(Arrays.asList(userNames)); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!((UniqueIDUserOperationEventListener) listener) .doPostGetRoleListOfUsersWithID(userIDsList, rolesOfUsersMap, userStoreManager)) { return false; } } } return true; }
Example #15
Source File: RoleManagementServiceImpl.java From carbon-device-mgt with Apache License 2.0 | 6 votes |
private List<String> getRolesFromUserStore(String filter, String userStore) throws UserStoreException { AbstractUserStoreManager userStoreManager = (AbstractUserStoreManager) DeviceMgtAPIUtils.getUserStoreManager(); String[] roles; if ((filter == null) || filter.isEmpty()) { filter = "*"; } else { filter += "*"; } if (log.isDebugEnabled()) { log.debug("Getting the list of user roles"); } if (userStore.equals("all")) { roles = userStoreManager.getRoleNames(filter, -1, true, true, true); } else { roles = userStoreManager.getRoleNames(userStore + "/" + filter, -1, true, true, true); } List<String> filteredRoles = new ArrayList<>(); for (String role : roles) { filteredRoles.add(role); } return filteredRoles; }
Example #16
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@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 #17
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostDeleteUserClaimValues(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) .doPostDeleteUserClaimValuesWithID(userID, userStoreManager)) { return false; } } } return true; }
Example #18
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPreDeleteUserClaimValues(String userName, String[] claims, 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) .doPreDeleteUserClaimValuesWithID(userID, claims, profileName, userStoreManager)) { return false; } } } return true; }
Example #19
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostSetUserClaimValues(String userName, Map<String, String> claims, 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) .doPostSetUserClaimValuesWithID(userID, claims, profileName, userStoreManager)) { return false; } } } return true; }
Example #20
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@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 #21
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPreSetUserClaimValue(String userName, String claimURI, String claimValue, 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)) { return ((UniqueIDUserOperationEventListener) listener) .doPreSetUserClaimValueWithID(userID, claimURI, claimValue, profileName, userStoreManager); } } return true; }
Example #22
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPreDeleteUser(String userName, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } String userID = ((AbstractUserStoreManager) userStoreManager).getUserIDFromUserName(userName); if (userID == null) { return handleUserIDResolveFailure(userName, userStoreManager); } // Setting the thread-local to keep userID for doPostDeleteUserWithID listener. IdentityUtil.threadLocalProperties.get().put(DO_PRE_DELETE_USER_USER_ID, userID); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!((UniqueIDUserOperationEventListener) listener).doPreDeleteUserWithID(userID, userStoreManager)) { return false; } } } return true; }
Example #23
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostUpdateCredentialByAdmin(String userName, Object credential, 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) .doPostUpdateCredentialByAdminWithID(userID, credential, userStoreManager)) { return false; } } } return true; }
Example #24
Source File: UserRealmProxy.java From carbon-identity with Apache License 2.0 | 6 votes |
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 #25
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostUpdateCredential(String userName, Object credential, 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) .doPostUpdateCredentialWithID(userID, credential, userStoreManager)) { return false; } } } return true; }
Example #26
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@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 #27
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPreAuthenticate(String userName, Object credential, 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) .doPreAuthenticateWithID(userID, credential, userStoreManager)) { return false; } } } return true; }
Example #28
Source File: IdentityUserNameResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@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 #29
Source File: IdentityUserNameResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPreAuthenticateWithID(List<LoginIdentifier> loginIdentifiers, Object credential, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } String username = ((AbstractUserStoreManager) userStoreManager).getUsernameByClaims(loginIdentifiers); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!listener.doPreAuthenticate(username, credential, userStoreManager)) { return false; } } } return true; }
Example #30
Source File: IdentityUserNameResolverListener.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
@Override public boolean doPostGetUsersClaimValuesWithID(List<String> userIDs, List<String> claims, String profileName, List<UniqueIDUserClaimSearchEntry> uniqueIDUserClaimSearchEntries, UserStoreManager userStoreManager) throws UserStoreException { if (!isEnable()) { return true; } List<String> userNamesList = ((AbstractUserStoreManager) userStoreManager).getUserNamesFromUserIDs(userIDs); String[] userNames = userNamesList.toArray(new String[0]); List<UserClaimSearchEntry> userClaimSearchEntries = ((AbstractUserStoreManager) userStoreManager) .getUserClaimSearchEntries(uniqueIDUserClaimSearchEntries); for (UserOperationEventListener listener : getUserStoreManagerListeners()) { if (isNotAResolverListener(listener)) { if (!listener.doPostGetUsersClaimValues(userNames, claims.toArray(new String[0]), profileName, userClaimSearchEntries.toArray(new UserClaimSearchEntry[0]))) { return false; } } } return true; }