private UserStoreManager getUserStoreManager(UserRealm realm, String userStoreDomain) throws UserStoreException, FrameworkException { UserStoreManager userStoreManager; if (userStoreDomain != null && !userStoreDomain.isEmpty()) { userStoreManager = realm.getUserStoreManager().getSecondaryUserStoreManager( userStoreDomain); } else { userStoreManager = realm.getUserStoreManager(); } if (userStoreManager == null) { throw new FrameworkException("Specified user store is invalid"); } return userStoreManager; }
private UserStoreManager getUserStoreManager(UserRealm realm, String userStoreDomain) throws UserStoreException, FrameworkException { UserStoreManager userStoreManager; if (userStoreDomain != null && !userStoreDomain.isEmpty()) { userStoreManager = realm.getUserStoreManager().getSecondaryUserStoreManager( userStoreDomain); } else { userStoreManager = realm.getUserStoreManager(); } if (userStoreManager == null) { throw new FrameworkException("Specified user store is invalid"); } return userStoreManager; }
private UserStoreManager getUserStoreManager(UserRealm realm, String userStoreDomain) throws UserStoreException, FrameworkException { UserStoreManager userStoreManager; if (userStoreDomain != null && !userStoreDomain.isEmpty()) { userStoreManager = realm.getUserStoreManager().getSecondaryUserStoreManager( userStoreDomain); } else { userStoreManager = realm.getUserStoreManager(); } if (userStoreManager == null) { throw new FrameworkException("Specified user store is invalid"); } return userStoreManager; }
public boolean hasMultipleUserStores() throws UserAdminException { try { return realm.getUserStoreManager().getSecondaryUserStoreManager() != null; } catch (UserStoreException e) { log.error(e); throw new UserAdminException("Unable to check for multiple user stores"); } }
public boolean isSharedRolesEnabled() throws UserAdminException { UserStoreManager userManager; try { userManager = realm.getUserStoreManager(); // TODO remove abstract user store return ((AbstractUserStoreManager) userManager).isSharedGroupEnabled(); } catch (UserStoreException e) { log.error(e); throw new UserAdminException("Unable to check shared role enabled", e); } }
public boolean isSharedRolesEnabled() throws UserAdminException { UserStoreManager userManager; try { userManager = realm.getUserStoreManager(); // TODO remove abstract user store return ((AbstractUserStoreManager) userManager).isSharedGroupEnabled(); } catch (UserStoreException e) { log.error(e); throw new UserAdminException("Unable to check shared role enabled", e); } }
public boolean hasMultipleUserStores() throws UserAdminException { try { return realm.getUserStoreManager().getSecondaryUserStoreManager() != null; } catch (UserStoreException e) { log.error(e); throw new UserAdminException("Unable to check for multiple user stores"); } }
/** * Verify user name/password authentication. * * @param username User name * @param password Password * @return true if user successfully authenticated */ public static boolean doLogin(String username, String password) { try { UserStoreManager userStore = IdentityTenantUtil.getRealm(null, username).getUserStoreManager(); return userStore.authenticate(username, password); } catch (Exception e) { log.error("Error while authenticating user", e); return false; } }
public boolean isAddUserEnabled() throws Exception { UserRealm userRealm = IdentityTenantUtil.getRealm(null, null); if (userRealm != null) { UserStoreManager userStoreManager = userRealm.getUserStoreManager(); if (userStoreManager != null) { return !userStoreManager.isReadOnly(); } } return false; }
public boolean isAddUserEnabled() throws Exception { UserRealm userRealm = IdentityTenantUtil.getRealm(null, null); if (userRealm != null) { UserStoreManager userStoreManager = userRealm.getUserStoreManager(); if (userStoreManager != null) { return !userStoreManager.isReadOnly(); } } return false; }
public boolean isAddProfileEnabled() throws UserProfileException { UserRealm realm = getUserRealm(); UserStoreManager userStoreManager = null; try { userStoreManager = realm.getUserStoreManager(); } catch (UserStoreException e) { String errorMessage = "Error in obtaining UserStoreManager."; log.error(errorMessage, e); throw new UserProfileException(errorMessage, e); } return userStoreManager.isMultipleProfilesAllowed(); }
/** * Compute the user store which user to be provisioned * * @return * @throws UserStoreException */ private String getUserStoreDomain(String userStoreDomain, UserRealm realm) throws FrameworkException, UserStoreException { // If the any of above value is invalid, keep it empty to use primary userstore if (userStoreDomain != null && realm.getUserStoreManager().getSecondaryUserStoreManager(userStoreDomain) == null) { throw new FrameworkException("Specified user store domain " + userStoreDomain + " is not valid."); } return userStoreDomain; }
public String[] listUsers(String filter, int maxLimit) throws UserAdminException { try { return realm.getUserStoreManager().listUsers(filter, maxLimit); } catch (UserStoreException e) { log.error(e.getMessage(), e); throw new UserAdminException(e.getMessage(), e); } catch (Exception e) { log.error(e.getMessage(), e); throw new UserAdminException(e.getMessage(), e); } }
public String[] listUsers(String filter, int maxLimit) throws UserAdminException { try { return realm.getUserStoreManager().listUsers(filter, maxLimit); } catch (UserStoreException e) { log.error(e.getMessage(), e); throw new UserAdminException(e.getMessage(), e); } catch (Exception e) { log.error(e.getMessage(), e); throw new UserAdminException(e.getMessage(), e); } }
public boolean isAddProfileEnabled() throws UserProfileException { UserRealm realm = getUserRealm(); UserStoreManager userStoreManager = null; try { userStoreManager = realm.getUserStoreManager(); } catch (UserStoreException e) { String errorMessage = "Error in obtaining UserStoreManager."; log.error(errorMessage, e); throw new UserProfileException(errorMessage, e); } return userStoreManager.isMultipleProfilesAllowed(); }
private UserStoreManager getUserStoreManager() throws UserStoreException { try { UserRealm realm = super.getUserRealm(); if (realm == null) { throw new UserStoreException(NULL_REALM_MESSAGE); } return realm.getUserStoreManager(); } catch (Exception e) { throw new UserStoreException(e); } }
protected UserStoreManager getUserStoreManager(int tenantId, String userStoreDomain) throws UserExportException { UserStoreManager userStoreManager; try { String tenantDomain = realmService.getTenantManager().getDomain(tenantId); userStoreManager = getUserRealm(tenantDomain).getUserStoreManager().getSecondaryUserStoreManager (userStoreDomain); } catch (UserStoreException e) { throw new UserExportException("Error while retrieving the user store manager.", e); } if (log.isDebugEnabled()) { log.debug("Retrieved user store manager for tenant id: " + tenantId); } return userStoreManager; }
private void validateUser(String username) throws UserProfileException { if (StringUtils.isBlank(username)) { throw new UserProfileException("Username cannot be empty."); } try { UserStoreManager userStoreManager = getUserRealm().getUserStoreManager(); if (!userStoreManager.isExistingUser(username)) { throw new UserProfileException("UserNotFound: User: " + username + " does not exist in tenant: " + getTenantDomain()); } } catch (UserStoreException e) { String msg = "Error occurred while verifying user: " + username + " exists in tenant: " + getTenantDomain(); log.error(msg, e); throw new UserProfileException(msg, e); } }
private String getSubjectClaimFromUserStore(String subjectClaimUri, AuthenticatedUser authenticatedUser) throws UserStoreException, IdentityException { UserStoreManager userStoreManager = IdentityTenantUtil .getRealm(authenticatedUser.getTenantDomain(), authenticatedUser.toFullQualifiedUsername()) .getUserStoreManager(); return userStoreManager .getSecondaryUserStoreManager(authenticatedUser.getUserStoreDomain()) .getUserClaimValue(authenticatedUser.getUserName(), subjectClaimUri, null); }
public static boolean authenticate(String username, String password) throws DataServiceFault { try { RegistryService registryService = DataServicesDSComponent.getRegistryService(); UserRealm realm = registryService.getUserRealm( PrivilegedCarbonContext.getThreadLocalCarbonContext().getTenantId()); username = MultitenantUtils.getTenantAwareUsername(username); return realm.getUserStoreManager().authenticate(username, password); } catch (Exception e) { throw new DataServiceFault(e, "Error in authenticating user '" + username + "'"); } }