Java Code Examples for org.wso2.carbon.identity.core.util.IdentityUtil#getPrimaryDomainName()
The following examples show how to use
org.wso2.carbon.identity.core.util.IdentityUtil#getPrimaryDomainName() .
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: UserStoreCountUtils.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * Create an instance of the given count retriever class * * @param domain * @return * @throws UserStoreCounterException */ public static UserStoreCountRetriever getCounterInstanceForDomain(String domain) throws UserStoreCounterException { if (StringUtils.isEmpty(domain)) { domain = IdentityUtil.getPrimaryDomainName(); } RealmConfiguration realmConfiguration = getUserStoreList().get(domain); if (realmConfiguration != null && realmConfiguration.getUserStoreProperty(COUNT_RETRIEVER_CLASS) != null) { String retrieverType = realmConfiguration.getUserStoreProperty(COUNT_RETRIEVER_CLASS); UserStoreCountRetriever userStoreCountRetriever = UserStoreCountDataHolder.getInstance() .getCountRetrieverFactories().get(retrieverType).buildCountRetriever(realmConfiguration); if (userStoreCountRetriever == null) { throw new UserStoreCounterException( "Could not create an instance of class: " + retrieverType + " for " + "the domain: " + domain); } return userStoreCountRetriever; } else { return null; } }
Example 2
Source File: UserAdmin.java From carbon-identity-framework with Apache License 2.0 | 6 votes |
/** * @param userStoreDomain * @param fileName * @param handler * @param defaultPassword * @throws UserAdminException */ public void bulkImportUsers(String userStoreDomain, String fileName, DataHandler handler, String defaultPassword) throws UserAdminException { //password will no longer be used, instead the password will be taken from the file if (fileName == null || handler == null) { throw new UserAdminException("Required data not provided"); } if (StringUtils.isEmpty(userStoreDomain)) { userStoreDomain = IdentityUtil.getPrimaryDomainName(); } try { InputStream inStream = handler.getInputStream(); getUserAdminProxy().bulkImportUsers(userStoreDomain, fileName, inStream, defaultPassword); } catch (IOException e) { log.error(e.getMessage(), e); throw new UserAdminException(e.getMessage(), e); } }
Example 3
Source File: UserAdmin.java From carbon-identity with Apache License 2.0 | 6 votes |
/** * @param userStoreDomain * @param fileName * @param handler * @param defaultPassword * @throws UserAdminException */ public void bulkImportUsers(String userStoreDomain, String fileName, DataHandler handler, String defaultPassword) throws UserAdminException { //password will no longer be used, instead the password will be taken from the file if (fileName == null || handler == null) { throw new UserAdminException("Required data not provided"); } if (StringUtils.isEmpty(userStoreDomain)) { userStoreDomain = IdentityUtil.getPrimaryDomainName(); } try { InputStream inStream = handler.getInputStream(); getUserAdminProxy().bulkImportUsers(userStoreDomain, fileName, inStream, defaultPassword); } catch (IOException e) { log.error(e.getMessage(), e); throw new UserAdminException(e.getMessage(), e); } }
Example 4
Source File: IdentityUserNameResolverListener.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
private String getUserStoreDomainName(UserStoreManager userStoreManager) { String domainNameProperty; domainNameProperty = userStoreManager.getRealmConfiguration() .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME); if (StringUtils.isBlank(domainNameProperty)) { domainNameProperty = IdentityUtil.getPrimaryDomainName(); } return domainNameProperty; }
Example 5
Source File: IdentityUserIdResolverListener.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
private String getUserStoreDomainName(UserStoreManager userStoreManager) { String domainNameProperty; domainNameProperty = userStoreManager.getRealmConfiguration() .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME); if (StringUtils.isBlank(domainNameProperty)) { domainNameProperty = IdentityUtil.getPrimaryDomainName(); } return domainNameProperty; }
Example 6
Source File: UserStoreCountUtils.java From carbon-identity-framework with Apache License 2.0 | 5 votes |
/** * Get the available list of user store domains * * @return * @throws UserStoreCounterException */ public static Map<String, RealmConfiguration> getUserStoreList() throws UserStoreCounterException { String domain; RealmConfiguration realmConfiguration; Map<String, RealmConfiguration> userStoreList = new HashMap<>(); try { realmConfiguration = CarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration(); domain = IdentityUtil.getPrimaryDomainName(); userStoreList.put(domain, realmConfiguration); while (realmConfiguration != null) { realmConfiguration = realmConfiguration.getSecondaryRealmConfig(); if (realmConfiguration != null) { domain = realmConfiguration .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME); userStoreList.put(domain, realmConfiguration); } else { break; } } } catch (UserStoreException e) { throw new UserStoreCounterException("Error while listing user stores for count functionality", e); } return userStoreList; }