当前位置: 首页>>代码示例>>Java>>正文


Java RealmConfiguration.getSecondaryRealmConfig方法代码示例

本文整理汇总了Java中org.wso2.carbon.user.api.RealmConfiguration.getSecondaryRealmConfig方法的典型用法代码示例。如果您正苦于以下问题:Java RealmConfiguration.getSecondaryRealmConfig方法的具体用法?Java RealmConfiguration.getSecondaryRealmConfig怎么用?Java RealmConfiguration.getSecondaryRealmConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.wso2.carbon.user.api.RealmConfiguration的用法示例。


在下文中一共展示了RealmConfiguration.getSecondaryRealmConfig方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getCountEnabledUserStores

import org.wso2.carbon.user.api.RealmConfiguration; //导入方法依赖的package包/类
/**
 * Get the domain names of user stores which has count functionality enabled
 *
 * @return
 */
public static Set<String> getCountEnabledUserStores() throws UserStoreCounterException {
    RealmConfiguration realmConfiguration;
    Set<String> userStoreList = new HashSet<>();

    try {
        realmConfiguration = CarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration();

        while (realmConfiguration != null) {
            if (!Boolean.valueOf(realmConfiguration.getUserStoreProperty(
                    UserCoreConstants.RealmConfig.USER_STORE_DISABLED))) {
                if (StringUtils.isNotEmpty(realmConfiguration.getUserStoreProperty(countRetrieverClass))) {
                    userStoreList.add(realmConfiguration
                            .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME));
                }
            }
            realmConfiguration = realmConfiguration.getSecondaryRealmConfig();
        }
    } catch (UserStoreException e) {
        throw new UserStoreCounterException("Error while getting the count enabled user stores", e);
    }

    return userStoreList;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:29,代码来源:UserStoreCountUtils.java

示例2: isUserStoreEnabled

import org.wso2.carbon.user.api.RealmConfiguration; //导入方法依赖的package包/类
public static boolean isUserStoreEnabled(String domain) throws UserStoreCounterException {

        RealmConfiguration realmConfiguration;
        boolean isEnabled = false;
        try {
            realmConfiguration = CarbonContext.getThreadLocalCarbonContext().getUserRealm().getRealmConfiguration();

            do {
                String userStoreDomain = realmConfiguration.
                        getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME);

                if (domain.equals(userStoreDomain)) {
                    isEnabled = !Boolean.valueOf(realmConfiguration.getUserStoreProperty(UserCoreConstants.RealmConfig.
                            USER_STORE_DISABLED));
                    break;
                }
                realmConfiguration = realmConfiguration.getSecondaryRealmConfig();
            } while (realmConfiguration != null);

        } catch (UserStoreException e) {
            throw new UserStoreCounterException("Error occurred while getting Secondary Realm Configuration", e);
        }
        return isEnabled;
    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:25,代码来源:UserStoreCountUtils.java

示例3: getUserStoreList

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

示例4: getSecondaryRealmConfigurations

import org.wso2.carbon.user.api.RealmConfiguration; //导入方法依赖的package包/类
/**
 * Get details of current secondary user store configurations
 *
 * @return : Details of all the configured secondary user stores
 * @throws UserStoreException
 */
public UserStoreDTO[] getSecondaryRealmConfigurations() throws IdentityUserStoreMgtException {
    ArrayList<UserStoreDTO> domains = new ArrayList<UserStoreDTO>();

    RealmConfiguration secondaryRealmConfiguration = null;
    try {
        secondaryRealmConfiguration = CarbonContext.getThreadLocalCarbonContext().getUserRealm().
                getRealmConfiguration().getSecondaryRealmConfig();
    } catch (UserStoreException e) {
        String errorMessage = "Error while retrieving user store configurations";
        log.error(errorMessage, e);
        throw new IdentityUserStoreMgtException(errorMessage);
    }

    //not editing primary store
    if (secondaryRealmConfiguration == null) {
        return null;
    } else {

        do {
            Map<String, String> userStoreProperties = secondaryRealmConfiguration.getUserStoreProperties();
            UserStoreDTO userStoreDTO = new UserStoreDTO();

            String uuid = userStoreProperties.get(UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT);
            if (uuid == null) {
                uuid = UUID.randomUUID().toString();
            }

            String randomPhrase = UserStoreConfigurationConstant.RANDOM_PHRASE_PREFIX + uuid;
            String className = secondaryRealmConfiguration.getUserStoreClass();
            userStoreDTO.setClassName(secondaryRealmConfiguration.getUserStoreClass());
            userStoreDTO.setDescription(secondaryRealmConfiguration.getUserStoreProperty(DESCRIPTION));
            userStoreDTO.setDomainId(secondaryRealmConfiguration.getUserStoreProperty(UserStoreConfigConstants.DOMAIN_NAME));
            if (userStoreProperties.get(DISABLED) != null) {
                userStoreDTO.setDisabled(Boolean.valueOf(userStoreProperties.get(DISABLED)));
            }
            userStoreProperties.put("Class", className);
            userStoreProperties.put(UserStoreConfigurationConstant.UNIQUE_ID_CONSTANT, uuid);
            RandomPassword[] randomPasswords = getRandomPasswordProperties(className, randomPhrase,
                    secondaryRealmConfiguration);
            if (randomPasswords != null) {
                updatePasswordContainer(randomPasswords, uuid);
            }

            String originalPassword = null;
            if (userStoreProperties.containsKey(UserStoreConfigConstants.connectionPassword)) {
                originalPassword = userStoreProperties.get(UserStoreConfigConstants.connectionPassword);
                userStoreProperties.put(UserStoreConfigConstants.connectionPassword, randomPhrase);
            }
            if (userStoreProperties.containsKey(JDBCRealmConstants.PASSWORD)) {
                originalPassword = userStoreProperties.get(JDBCRealmConstants.PASSWORD);
                userStoreProperties.put(JDBCRealmConstants.PASSWORD, randomPhrase);
            }
            userStoreDTO.setProperties(convertMapToArray(userStoreProperties));

            //Now revert back to original password
            if (userStoreProperties.containsKey(UserStoreConfigConstants.connectionPassword)) {
                if (originalPassword != null) {
                    userStoreProperties.put(UserStoreConfigConstants.connectionPassword, originalPassword);
                }
            }
            if (userStoreProperties.containsKey(JDBCRealmConstants.PASSWORD)) {
                if (originalPassword != null) {
                    userStoreProperties.put(JDBCRealmConstants.PASSWORD, originalPassword);
                }
            }

            domains.add(userStoreDTO);
            secondaryRealmConfiguration = secondaryRealmConfiguration.getSecondaryRealmConfig();

        } while (secondaryRealmConfiguration != null);
    }
    return domains.toArray(new UserStoreDTO[domains.size()]);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:80,代码来源:UserStoreConfigAdminService.java


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