• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java RealmConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



RealmConfiguration类属于org.wso2.carbon.user.api包,在下文中一共展示了RealmConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getPasswordConformanceRegularExpression

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
/**
 * Gets the regular expression which defines the format of the service principle, password.
 *
 * @return Regular expression.
 * @throws DirectoryServerManagerException If unable to get RealmConfiguration.
 */
public String getPasswordConformanceRegularExpression() throws DirectoryServerManagerException {

    try {
        RealmConfiguration userStoreConfigurations = this.getUserRealm().getRealmConfiguration();
        if (userStoreConfigurations != null) {
            String passwordRegEx = userStoreConfigurations.getUserStoreProperty(
                    LDAPServerManagerConstants.SERVICE_PASSWORD_REGEX_PROPERTY);
            if (passwordRegEx == null) {
                return LDAPServerManagerConstants.DEFAULT_PASSWORD_REGULAR_EXPRESSION;
            } else {
                log.info("Service password format is " + passwordRegEx);
                return passwordRegEx;
            }
        }
    } catch (UserStoreException e) {
        log.error("Unable to retrieve service password format.", e);
        throw new DirectoryServerManagerException("Unable to retrieve service password format.", e);
    }

    return LDAPServerManagerConstants.DEFAULT_PASSWORD_REGULAR_EXPRESSION;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:DirectoryServerManager.java


示例2: getServiceNameConformanceRegularExpression

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
/**
 * Gets the regular expression which defines the format of the service principle.
 * Current we use following like format,
 * ftp/localhost
 *
 * @return Service principle name format as a regular expression.
 * @throws DirectoryServerManagerException If unable to retrieve RealmConfiguration.
 */
public String getServiceNameConformanceRegularExpression() throws DirectoryServerManagerException {

    try {
        RealmConfiguration userStoreConfigurations = this.getUserRealm().getRealmConfiguration();
        if (userStoreConfigurations != null) {
            String serviceNameRegEx = userStoreConfigurations.getUserStoreProperty(
                    LDAPServerManagerConstants.SERVICE_PRINCIPLE_NAME_REGEX_PROPERTY);
            if (serviceNameRegEx == null) {
                return LDAPServerManagerConstants.DEFAULT_SERVICE_NAME_REGULAR_EXPRESSION;
            } else {
                log.info("Service name format is " + serviceNameRegEx);
                return serviceNameRegEx;
            }
        }
    } catch (UserStoreException e) {
        log.error("Unable to retrieve service name format.", e);
        throw new DirectoryServerManagerException("Unable to retrieve service name format.", e);
    }

    return LDAPServerManagerConstants.DEFAULT_SERVICE_NAME_REGULAR_EXPRESSION;
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:30,代码来源:DirectoryServerManager.java


示例3: getDBConnection

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
private Connection getDBConnection(RealmConfiguration realmConfiguration) throws SQLException, UserStoreException {

        Connection dbConnection = null;
        DataSource dataSource = DatabaseUtil.createUserStoreDataSource(realmConfiguration);

        if (dataSource != null) {
            dbConnection = DatabaseUtil.getDBConnection(dataSource);
        }

        //if primary user store, DB connection can be same as realm data source.
        if (dbConnection == null && realmConfiguration.isPrimary()) {
            dbConnection = IdentityDatabaseUtil.getUserDBConnection();
        } else if (dbConnection == null) {
            throw new UserStoreException("Could not create a database connection to " +
                    realmConfiguration.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_NAME));
        } else {
            // db connection is present
        }
        dbConnection.setAutoCommit(false);
        dbConnection.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
        return dbConnection;
    }
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:23,代码来源:JDBCUserStoreCountRetriever.java


示例4: 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


示例5: getCounterInstanceForDomain

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
/**
 * 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(countRetrieverClass) != null) {
        String retrieverType = realmConfiguration.getUserStoreProperty(countRetrieverClass);
        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;
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:28,代码来源:UserStoreCountUtils.java


示例6: 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


示例7: getRandomPasswordProperties

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
/**
 * Generate the RandomPassword[] from secondaryRealmConfiguration for given userStoreClass
 *
 * @param userStoreClass              Extract the mandatory properties of this class
 * @param randomPhrase                The randomly generated keyword which will be stored in
 *                                    RandomPassword object
 * @param secondaryRealmConfiguration RealmConfiguration object consists the properties
 * @return RandomPassword[] array for each property
 */
private RandomPassword[] getRandomPasswordProperties(String userStoreClass,
                                                     String randomPhrase, RealmConfiguration secondaryRealmConfiguration) {
    //First check for mandatory field with #encrypt
    Property[] mandatoryProperties = getMandatoryProperties(userStoreClass);
    ArrayList<RandomPassword> randomPasswordArrayList = new ArrayList<RandomPassword>();
    for (Property property : mandatoryProperties) {
        String propertyName = property.getName();
        if (property.getDescription().contains(UserStoreConfigurationConstant.ENCRYPT_TEXT)) {
            RandomPassword randomPassword = new RandomPassword();
            randomPassword.setPropertyName(propertyName);
            randomPassword.setPassword(secondaryRealmConfiguration.getUserStoreProperty(propertyName));
            randomPassword.setRandomPhrase(randomPhrase);
            randomPasswordArrayList.add(randomPassword);
        }
    }
    return randomPasswordArrayList.toArray(new RandomPassword[randomPasswordArrayList.size()]);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:27,代码来源:UserStoreConfigAdminService.java


示例8: terminatingConfigurationContext

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
public void terminatingConfigurationContext(ConfigurationContext context) {
    try {
        org.wso2.carbon.user.api.UserRealm tenantRealm = CarbonContext
                .getThreadLocalCarbonContext().getUserRealm();
        RealmConfiguration realmConfig = tenantRealm.getRealmConfiguration();
        AbstractUserStoreManager userStoreManager = (AbstractUserStoreManager) tenantRealm
                .getUserStoreManager();
        userStoreManager.clearAllSecondaryUserStores();
        realmConfig.setSecondaryRealmConfig(null);
        userStoreManager.setSecondaryUserStoreManager(null);
        log.info("Unloaded all secondary user stores for tenant "
                + CarbonContext.getThreadLocalCarbonContext().getTenantId());
    } catch (Exception ex) {
        log.error(ex.getMessage());
    }
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:17,代码来源:UserStoreConfgurationContextObserver.java


示例9: isAdminProfileSpoof

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
/**
 * Checks whether the given user name is admin user name and the currently logged in user also admin.
 * Only admin user is allowed for admin user profile related operations.
 *
 * @param username Username to be checked.
 * @return True only if admin user.
 * @throws UserStoreException Error occurred while retrieving realm configuration.
 */
private boolean isAdminProfileSpoof(String username) throws UserStoreException {

    if (StringUtils.isEmpty(username)) {
        return false;
    }

    RealmConfiguration realmConfiguration = getUserRealm().getRealmConfiguration();
    String adminUsername = IdentityUtil.addDomainToName(realmConfiguration.getAdminUserName(),
            IdentityUtil.getPrimaryDomainName());
    String targetUsername = IdentityUtil.addDomainToName(username, IdentityUtil.getPrimaryDomainName());

    // If the given user name is not the admin username, simply we can allow and return false. Our intention is to
    // check whether a non admin user is trying to do operations on an admin profile.
    if (!StringUtils.equalsIgnoreCase(targetUsername, adminUsername)) {
        return false;
    }

    String loggedInUsername = CarbonContext.getThreadLocalCarbonContext().getUsername();
    if (loggedInUsername != null) {
        loggedInUsername = IdentityUtil.addDomainToName(loggedInUsername, IdentityUtil.getPrimaryDomainName());
    }

    // If the currently logged in user is also the admin user this isn't a spoof attempt. Hence returning false.
    return !StringUtils.equalsIgnoreCase(loggedInUsername, adminUsername);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:34,代码来源:UserProfileAdmin.java


示例10: getUserStoreCountRetrieverService

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
public static UserStoreCountRetriever getUserStoreCountRetrieverService()
        throws UserStoreCounterException {
    PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
    List<Object> countRetrieverFactories = ctx.getOSGiServices(AbstractCountRetrieverFactory.class, null);
    RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
    RealmConfiguration realmConfiguration = realmService.getBootstrapRealmConfiguration();
    String userStoreType;
    //Ignoring Sonar warning as getUserStoreClass() returning string name of the class. So cannot use 'instanceof'.
    if (JDBCUserStoreManager.class.getName().equals(realmConfiguration.getUserStoreClass())) {
        userStoreType = JDBCCountRetrieverFactory.JDBC;
    } else {
        userStoreType = InternalCountRetrieverFactory.INTERNAL;
    }
    AbstractCountRetrieverFactory countRetrieverFactory = null;
    for (Object countRetrieverFactoryObj : countRetrieverFactories) {
        countRetrieverFactory = (AbstractCountRetrieverFactory) countRetrieverFactoryObj;
        if (userStoreType.equals(countRetrieverFactory.getCounterType())) {
            break;
        }
    }
    if (countRetrieverFactory == null) {
        return null;
    }
    return countRetrieverFactory.buildCountRetriever(realmConfiguration);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:26,代码来源:DeviceMgtAPIUtils.java


示例11: setup

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
@BeforeClass
public void setup() throws UserStoreException {
    initMocks(this);
    userManagementService = new UserManagementServiceImpl();
    userStoreManager = Mockito.mock(UserStoreManager.class, Mockito.RETURNS_MOCKS);
    deviceManagementProviderService = Mockito
            .mock(DeviceManagementProviderServiceImpl.class, Mockito.CALLS_REAL_METHODS);
    userRealm = Mockito.mock(UserRealm.class);
    RealmConfiguration realmConfiguration = Mockito.mock(RealmConfiguration.class);
    Mockito.doReturn(null).when(realmConfiguration).getSecondaryRealmConfig();
    Mockito.doReturn(realmConfiguration).when(userRealm).getRealmConfiguration();
    enrollmentInvitation = new EnrollmentInvitation();
    List<String> recipients = new ArrayList<>();
    recipients.add(TEST_USERNAME);
    enrollmentInvitation.setDeviceType("android");
    enrollmentInvitation.setRecipients(recipients);
    userList = new ArrayList<>();
    userList.add(TEST_USERNAME);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:20,代码来源:UserManagementServiceImplTest.java


示例12: getUserStoreCountRetrieverService

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
public static UserStoreCountRetriever getUserStoreCountRetrieverService()
        throws UserStoreCounterException, UserStoreException {
    PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
    List<Object> countRetrieverFactories = ctx.getOSGiServices(AbstractCountRetrieverFactory.class, null);
    RealmService realmService = (RealmService) ctx.getOSGiService(RealmService.class, null);
    RealmConfiguration realmConfiguration = realmService.getBootstrapRealmConfiguration();
    String userStoreType;
    if(DeviceMgtAPIUtils.getUserStoreManager() instanceof JDBCUserStoreManager) {
        userStoreType = JDBCCountRetrieverFactory.JDBC;
    } else {
        userStoreType = InternalCountRetrieverFactory.INTERNAL;
    }
    AbstractCountRetrieverFactory countRetrieverFactory = null;
    for (Object countRetrieverFactoryObj : countRetrieverFactories) {
        countRetrieverFactory = (AbstractCountRetrieverFactory) countRetrieverFactoryObj;
        if (userStoreType.equals(countRetrieverFactory.getCounterType())) {
            break;
        }
    }
    if (countRetrieverFactory == null) {
        return null;
    }
    return countRetrieverFactory.buildCountRetriever(realmConfiguration);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:25,代码来源:DeviceMgtAPIUtils.java


示例13: getMultiAttributeSeparator

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
private String getMultiAttributeSeparator(String authenticatedUser, int tenantId) {
    String claimSeparator = null;
    String userDomain = IdentityUtil.extractDomainFromName(authenticatedUser);

    try {
        RealmConfiguration realmConfiguration = null;
        RealmService realmService = OAuthComponentServiceHolder.getRealmService();

        if (realmService != null && tenantId != MultitenantConstants.INVALID_TENANT_ID) {
            UserStoreManager userStoreManager = (UserStoreManager) realmService.getTenantUserRealm(tenantId)
                    .getUserStoreManager();
            realmConfiguration = userStoreManager.getSecondaryUserStoreManager(userDomain).getRealmConfiguration();
        }

        if (realmConfiguration != null) {
            claimSeparator = realmConfiguration.getUserStoreProperty(IdentityCoreConstants.MULTI_ATTRIBUTE_SEPARATOR);
            if (claimSeparator != null && !claimSeparator.trim().isEmpty()) {
                return claimSeparator;
            }
        }
    } catch (UserStoreException e) {
        log.error("Error occurred while getting the realm configuration, User store properties might not be " +
                  "returned", e);
    }
    return null;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:27,代码来源:JWTTokenGenerator.java


示例14: getRealmConfiguration

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
public RealmConfigurationDTO getRealmConfiguration() throws UserStoreException {
    UserRealm userRealm = getApplicableUserRealm();
    RealmConfiguration realmConfig = userRealm.getRealmConfiguration();
    RealmConfigurationDTO realmConfigDTO = new RealmConfigurationDTO();
    realmConfigDTO.setRealmClassName(realmConfig.getRealmClassName());
    realmConfigDTO.setUserStoreClass(realmConfig.getUserStoreClass());
    realmConfigDTO.setAuthorizationManagerClass(realmConfig.getAuthorizationManagerClass());
    realmConfigDTO.setAdminRoleName(realmConfig.getAdminRoleName());
    realmConfigDTO.setAdminUserName(realmConfig.getAdminUserName());
    realmConfigDTO.setAdminPassword(realmConfig.getAdminPassword());
    realmConfigDTO.setEveryOneRoleName(realmConfig.getEveryOneRoleName());
    realmConfigDTO.setUserStoreProperties(getPropertyValueArray(realmConfig
            .getUserStoreProperties()));
    realmConfigDTO.setAuthzProperties(getPropertyValueArray(realmConfig.getAuthzProperties()));
    realmConfigDTO.setRealmProperties(getPropertyValueArray(realmConfig.getRealmProperties()));
    return realmConfigDTO;
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:18,代码来源:UserRealmService.java


示例15: convertToRealmConfiguration

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
public static RealmConfiguration convertToRealmConfiguration(RealmConfigurationDTO realmConfigDTO) {
    RealmConfiguration realmConfig = new RealmConfiguration();
    realmConfig.setRealmClassName(realmConfigDTO.getRealmClassName());
    realmConfig.setUserStoreClass(realmConfigDTO.getUserStoreClass());
    realmConfig.setAuthorizationManagerClass(realmConfigDTO.getAuthorizationManagerClass());
    realmConfig.setAdminRoleName(realmConfigDTO.getAdminRoleName());
    realmConfig.setAdminUserName(realmConfigDTO.getAdminUserName());
    realmConfig.setAdminPassword(realmConfigDTO.getAdminPassword());
    realmConfig.setEveryOneRoleName(realmConfigDTO.getEveryOneRoleName());
    realmConfig.setUserStoreProperties(getPropertyValueMap(realmConfigDTO
            .getUserStoreProperties()));
    realmConfig.setAuthzProperties(getPropertyValueMap(realmConfigDTO.getAuthzProperties()));
    realmConfig.setRealmProperties(getPropertyValueMap(realmConfigDTO.getRealmProperties()));
    return realmConfig;

}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:17,代码来源:WSRealmUtil.java


示例16: init

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
/**
 * Initialize WSRealm by Non-carbon environment
 */
public void init(RealmConfiguration configBean, ConfigurationContext configCtxt)
        throws UserStoreException {
    realmConfig = configBean;

    if (UserMgtWSAPIDataHolder.getInstance().getSessionCookie() == null) {
        synchronized (WSRealm.class) {
            if (UserMgtWSAPIDataHolder.getInstance().getSessionCookie() == null) {
                login();
            }
        }
    }

    if (UserMgtWSAPIDataHolder.getInstance().getSessionCookie() == null) {
        throw new UserStoreException(REALM_CREATION_ERROR_MESSAGE);
    }

    init((String) realmConfig.getRealmProperty(WSRemoteUserMgtConstants.SERVER_URL),
            UserMgtWSAPIDataHolder.getInstance().getSessionCookie(), configCtxt);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:23,代码来源:WSRealm.java


示例17: setup

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
@Before
public void setup() throws UserStoreException, IOException, RegistryException {
    userRegistry = mock(UserRegistry.class);
    when(userRegistry.getUserName()).thenReturn("admin");
    RegistryRealm registryRealm = PowerMockito.mock(RegistryRealm.class);
    UserStoreManager userStoreManager = PowerMockito.mock(UserStoreManager.class);
    when(userStoreManager.getRoleListOfUser("admin"))
            .thenReturn(new String[]{"admin", "internal/everyone", "internal/publisher"});
    when(userStoreManager.getRoleListOfUser("danesh"))
            .thenReturn(new String[]{"internal/everyone", "internal/publisher"});
    when(registryRealm.getUserStoreManager()).thenReturn(userStoreManager);
    RealmConfiguration realmConfiguration = new RealmConfiguration();
    realmConfiguration.setAdminRoleName("admin");
    when(registryRealm.getRealmConfiguration()).thenReturn(realmConfiguration);
    when(userRegistry.getUserRealm()).thenReturn(registryRealm);
}
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:17,代码来源:ActivityBeanPopulatorTest.java


示例18: initObjStuff

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
public void initObjStuff() throws Exception {

        String dbFolder = "target/PersonManagerTest";
        if ((new File(dbFolder)).exists()) {
            deleteDir(new File(dbFolder));
        }

        BasicDataSource ds = new BasicDataSource();
        ds.setDriverClassName(SocialImplTestConstants.DB_DRIVER);
        ds.setUrl(TEST_URL);
        DatabaseCreator creator = new DatabaseCreator(ds);
        creator.createRegistryDatabase();

        realm = new DefaultRealm();
        InputStream inStream = this.getClass().getClassLoader().getResource(
                PersonManagerImplTest.JDBC_TEST_USERMGT_XML).openStream();
        RealmConfiguration realmConfig = TestRealmConfigBuilder
                .buildRealmConfigWithJDBCConnectionUrl(inStream, TEST_URL);
        realm.init(realmConfig, ClaimTestUtil.getClaimTestData(), ClaimTestUtil
                .getProfileTestData(), 0);

    }
 
开发者ID:wso2,项目名称:carbon-registry,代码行数:23,代码来源:PersonManagerImplTest.java


示例19: getUserRealm

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
public UserRealm getUserRealm(RealmConfiguration tenantRealmConfig) throws UserStoreException {
    int tenantId = tenantRealmConfig.getTenantId();
    if (tenantId == -1234) {
        return this.bootstrapRealm;
    } else {
        UserRealm userRealm = (UserRealm) this.userRealmMap.get(Integer.valueOf(tenantId));
        if (userRealm == null) {
            userRealm = this.initializeRealm(tenantRealmConfig, tenantId);
            this.userRealmMap.put(Integer.valueOf(tenantId), userRealm);
        } else {
            long existingRealmPersistedTime = -1L;
            long newRealmConfigPersistedTime = -1L;
            if (userRealm.getRealmConfiguration().getPersistedTimestamp() != null) {
                existingRealmPersistedTime = userRealm.getRealmConfiguration().getPersistedTimestamp().getTime();
            }

            if (tenantRealmConfig.getPersistedTimestamp() != null) {
                newRealmConfigPersistedTime = tenantRealmConfig.getPersistedTimestamp().getTime();
            }

            if (existingRealmPersistedTime != newRealmConfigPersistedTime) {
                userRealm = this.initializeRealm(tenantRealmConfig, tenantId);
                this.userRealmMap.put(Integer.valueOf(tenantId), userRealm);
            }
        }

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


示例20: init

import org.wso2.carbon.user.api.RealmConfiguration; //导入依赖的package包/类
@Override
public void init(RealmConfiguration realmConfiguration, Map<String, ClaimMapping> map,
        Map<String, ProfileConfiguration> map1, int tenantId) throws UserStoreException {
    this.realmConfiguration = realmConfiguration;
    this.tenantId = tenantId;
    ((MockUserStoreManager)this.userStoreManager).setRealmConfiguration(this.realmConfiguration);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:8,代码来源:MockRealm.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Base64类代码示例发布时间:2022-05-23
下一篇:
Java FileTextureData类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap