Examples of RealmConfiguration


Examples of org.wso2.carbon.user.api.RealmConfiguration

        if (!isDomainAvailable) {
            throw new Exception("Domain is not available to register");
        }

        RealmService realmService = TenantMgtCoreServiceComponent.getRealmService();
        RealmConfiguration realmConfig = realmService.getBootstrapRealmConfiguration();
        TenantMgtConfiguration tenantMgtConfiguration = realmService.getTenantMgtConfiguration();
        MultiTenantRealmConfigBuilder builder =
                                                TenantMgtCoreServiceComponent.getRealmService()
                                                                             .
                                                                              getMultiTenantRealmConfigBuilder();
        RealmConfiguration realmConfigToPersist =
                builder.getRealmConfigForTenantToPersist(realmConfig, tenantMgtConfiguration,
                                                         tenant,
                                                         -1);
        tenant.setRealmConfig(realmConfigToPersist);
        tenantId = addTenant(tenant);
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

     */
    private void validateAdminUserName(Tenant tenant) throws Exception {
        UserRealm tenantZeroUserRealm =
                                        TenantMgtCoreServiceComponent.getRealmService().
                                                                      getBootstrapRealm();
        RealmConfiguration realmConfig =
                                         TenantMgtCoreServiceComponent.getBootstrapRealmConfiguration();
        String uniqueAcrossTenants =
                                     realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_USERNAME_UNIQUE);
        if ("true".equals(uniqueAcrossTenants)) {
            try {
                if (tenantZeroUserRealm.getUserStoreManager().isExistingUser(tenant.getAdminName())) {
                    throw new Exception("User name : " + tenant.getAdminName() +
                                        " exists in the system. " +
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

            return;
        }

        try {
            AuthorizationManager accessControlAdmin = userRealm.getAuthorizationManager();
            RealmConfiguration realmConfig;
            try {
                realmConfig = userRealm.getRealmConfiguration();
            } catch (UserStoreException e) {
                String msg = "Failed to retrieve realm configuration.";
                log.error(msg, e);
                throw new RegistryException(msg, e);
            }

            String everyoneRole = realmConfig.getEveryOneRoleName();

            accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.GET);
            accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.PUT);
            accessControlAdmin.denyRole(everyoneRole, path, ActionConstants.DELETE);
            accessControlAdmin.denyRole(everyoneRole, path, AccessControlConstants.AUTHORIZE);
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

        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);

    }
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

    public static final String JDBC_URL_PROPERTY_NAME = "url";

    public static RealmConfiguration buildRealmConfigWithJDBCConnectionUrl(InputStream inStream,
            String connectionUrl) throws UserStoreException {
        RealmConfigXMLProcessor builder = new RealmConfigXMLProcessor();
        RealmConfiguration realmConfig = builder.buildRealmConfiguration(inStream);
        Map<String, String> map = realmConfig.getRealmProperties();
        map.put(JDBC_URL_PROPERTY_NAME, connectionUrl);
        return realmConfig;
    }
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

     * @throws Exception UserStoreException
     */
    public static UserStoreManager getUserStoreManager(Tenant tenant, int tenantId)
            throws Exception {
        // get the system registry for the tenant
        RealmConfiguration realmConfig = TenantMgtServiceComponent.getBootstrapRealmConfiguration();
        TenantMgtConfiguration tenantMgtConfiguration =
                TenantMgtServiceComponent.getRealmService().getTenantMgtConfiguration();
        UserRealm userRealm;
        try {
            MultiTenantRealmConfigBuilder builder =
                    TenantMgtServiceComponent.getRealmService().
                            getMultiTenantRealmConfigBuilder();
            RealmConfiguration realmConfigToPersist =
                    builder.getRealmConfigForTenantToPersist(realmConfig, tenantMgtConfiguration,
                                                             tenant,
                                                             tenantId);

            RealmConfiguration realmConfigToCreate =
                    builder.
                            getRealmConfigForTenantToCreateRealmOnTenantCreation(realmConfig,
                                                                                 realmConfigToPersist,
                                                                                 tenantId);
            userRealm =
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

     * This is not called on ws.api startup or by any non-Idaas servers
     */
    public RealmConfiguration getRealmConfigForTenantToCreateRealm(
            RealmConfiguration bootStrapConfig, RealmConfiguration persistedConfig, int tenantId)
            throws UserStoreException {
        RealmConfiguration realmConfig;
        try {
                realmConfig = persistedConfig;
               // now this is Idaas
                Map<String, String> realmProps = realmConfig.getRealmProperties();
                Map<String, String> bootStrapProps = bootStrapConfig.getRealmProperties();
                realmProps.put(JDBCRealmConstants.URL, bootStrapProps.get(JDBCRealmConstants.URL));
                realmProps.put(JDBCRealmConstants.DRIVER_NAME, bootStrapProps.get(
                        JDBCRealmConstants.DRIVER_NAME));
                realmProps.put(JDBCRealmConstants.USER_NAME, bootStrapProps.get(
                        JDBCRealmConstants.USER_NAME));
                realmProps.put(JDBCRealmConstants.PASSWORD, bootStrapProps.get(
                        JDBCRealmConstants.PASSWORD));
                realmConfig.setTenantId(tenantId);

                if(log.isDebugEnabled()) {
                    OMElement omElement = RealmConfigXMLProcessor.serialize(realmConfig);
                    log.debug("Creating realm from **** " + omElement.toString());
                }
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

     * This is not called on ws.api startup.
     */
    public RealmConfiguration getRealmConfigForTenantToCreateRealm(
            RealmConfiguration bootStrapConfig, RealmConfiguration persistedConfig, int tenantId)
            throws UserStoreException {
        RealmConfiguration realmConfig;
        try {
            if (persistedConfig.getRealmClassName().equals(WSRealm.class.getName())) {
                realmConfig = persistedConfig;
            } else {
                realmConfig = bootStrapConfig.cloneRealmConfiguration();
                realmConfig.setTenantId(tenantId);
            }
            if (log.isDebugEnabled()) {
                OMElement omElement = RealmConfigXMLProcessor.serialize(realmConfig);
                log.debug("Creating realm from **** " + omElement.toString());
            }
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

    }

    public RealmConfiguration getRealmConfigForTenantToCreateRealmOnTenantCreation(
            RealmConfiguration bootStrapConfig, RealmConfiguration persistedConfig, int tenantId)
            throws UserStoreException{
        RealmConfiguration realmConfig;
        try {
            realmConfig = bootStrapConfig.cloneRealmConfiguration();
            realmConfig.setRealmClassName("org.wso2.carbon.um.ws.api.WSRealm");
           
            realmConfig.setAdminPassword(UUIDGenerator.getUUID());
            Map<String, String> realmProps = realmConfig.getRealmProperties();
            realmProps.remove(JDBCRealmConstants.URL);
            realmProps.remove(JDBCRealmConstants.DRIVER_NAME);
            realmProps.remove(JDBCRealmConstants.USER_NAME);
            realmProps.remove(JDBCRealmConstants.PASSWORD);
           
            realmConfig.setTenantId(tenantId);

            if (log.isDebugEnabled()) {
                OMElement omElement = RealmConfigXMLProcessor.serialize(realmConfig);
                log.debug("Creating realm from (On tenant creation)**** " + omElement.toString());
            }
View Full Code Here

Examples of org.wso2.carbon.user.api.RealmConfiguration

    public RealmConfiguration getRealmConfigForTenantToPersist(RealmConfiguration bootStrapConfig,
                                                               TenantMgtConfiguration tenantMgtConfig,
                                                               Tenant tenantInfo, int tenantId)
            throws UserStoreException {
        RealmConfiguration realmConfig;
        try {
            realmConfig = bootStrapConfig.cloneRealmConfiguration();
            realmConfig.setAdminUserName(tenantInfo.getAdminName());
            realmConfig.setAdminPassword(UUIDGenerator.getUUID());
            Map<String, String> realmProps = realmConfig.getRealmProperties();
            realmProps.remove(JDBCRealmConstants.URL);
            realmProps.remove(JDBCRealmConstants.DRIVER_NAME);
            realmProps.remove(JDBCRealmConstants.USER_NAME);
            realmProps.remove(JDBCRealmConstants.PASSWORD);
            realmProps.remove(WSRemoteUserMgtConstants.SERVER_URL);
            realmProps.remove(WSRemoteUserMgtConstants.USER_NAME);
            realmProps.remove(WSRemoteUserMgtConstants.PASSWORD);
            realmProps.remove(WSRemoteUserMgtConstants.SINGLE_USER_AUTHENTICATION);
            realmProps.put("MultiTenantRealmConfigBuilder", IdaasWSRealmConfigBuilder.class.getName());
            realmConfig.setTenantId(tenantId);
            if (log.isDebugEnabled()) {
                OMElement omElement = RealmConfigXMLProcessor.serialize(realmConfig);
                log.debug("Saving RealmConfiguration **** " + omElement.toString());
            }

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.