Examples of RealmConfiguration


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

        Date createdDate = new Date(result.getTimestamp(
            "UM_CREATED_DATE").getTime());
        InputStream is = result.getBinaryStream("UM_USER_CONFIG");
                 
          RealmConfigXMLProcessor processor = new RealmConfigXMLProcessor();
          RealmConfiguration realmConfig = processor.buildRealmConfiguration(is);
          realmConfig.setTenantId(id);
         
        tenant = new Tenant();
        tenant.setId(id);
        tenant.setDomain(domain);
        tenant.setEmail(email);
        tenant.setCreatedDate(createdDate);
        tenant.setActive(active);
        tenant.setRealmConfig(realmConfig);
        tenant.setAdminName(realmConfig.getAdminUserName());
        tenantCacheManager.addToCache(new TenantIdKey(id), new TenantCacheEntry(tenant));
      }
      dbConnection.commit();
        } catch (SQLException e) {
View Full Code Here

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

                    new RealmUnawareRegistryCoreServiceComponent();
            comp.setRealmService(ctx.getRealmService());
            comp.registerBuiltInHandlers(embeddedRegistryService);
           
            // get the realm config to retrieve admin username, password
            RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
            registry = embeddedRegistryService.getUserRegistry(
                realmConfig.getAdminUserName(), realmConfig.getAdminPassword());
        } catch (RegistryException e) {
                fail("Failed to initialize the registry. Caused by: " + e.getMessage());
        }
    }
View Full Code Here

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

                    new RealmUnawareRegistryCoreServiceComponent();
            comp.setRealmService(ctx.getRealmService());
            comp.registerBuiltInHandlers(embeddedRegistryService);
           
            // get the realm config to retrieve admin username, password
            RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
            registry = embeddedRegistryService.getUserRegistry(
                realmConfig.getAdminUserName(), realmConfig.getAdminPassword());
        } catch (RegistryException e) {
                fail("Failed to initialize the registry. Caused by: " + e.getMessage());
        }
    }
View Full Code Here

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

            RealmUnawareRegistryCoreServiceComponent comp =
                    new RealmUnawareRegistryCoreServiceComponent();
            comp.setRealmService(ctx.getRealmService());
            comp.registerBuiltInHandlers(embeddedRegistryService);
            // get the realm config to retrieve admin username, password
            RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
            registry = embeddedRegistryService.getUserRegistry(
                realmConfig.getAdminUserName(), realmConfig.getAdminPassword());
        } catch (RegistryException e) {
            throw new RuntimeException(e);
            //fail("Failed to initialize the registry. Caused by: " + e.getMessage());

        }
View Full Code Here

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

    public RealmConfiguration buildRealmConfigurationFromFile() throws UserStoreException {
        OMElement realmElement;
        try {
            realmElement = getRealmElement();

            RealmConfiguration realmConfig = buildRealmConfiguration(realmElement);

            if (inStream != null) {
                inStream.close();
            }
            return realmConfig;
View Full Code Here

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

            OMElement documentElement = builder.getDocumentElement();

            realmElement = documentElement.getFirstChildWithName(new QName(
                    UserCoreConstants.RealmConfig.LOCAL_NAME_REALM));

            RealmConfiguration realmConfig = buildRealmConfiguration(realmElement);

            if (inStream != null) {
                inStream.close();
            }
            return realmConfig;
View Full Code Here

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

        }

    }

    public RealmConfiguration buildRealmConfiguration(OMElement realmElem) {
        RealmConfiguration realmConfig = null;
        String userStoreClass = null;
        String authorizationManagerClass = null;
        String adminRoleName = null;
        String adminUserName = null;
        String adminPassword = null;
        String everyOneRoleName = null;
        String realmClass = null;
        Map<String, String> userStoreProperties = null;
        Map<String, String> authzProperties = null;
        Map<String, String> realmProperties = null;  
        boolean passwordsExternallyManaged = false;

    realmClass = (String) realmElem.getAttributeValue(new QName(
        UserCoreConstants.RealmConfig.ATTR_NAME_CLASS));
       
        OMElement mainConfig = realmElem.getFirstChildWithName(new QName(
                UserCoreConstants.RealmConfig.LOCAL_NAME_CONFIGURATION));
        realmProperties = getChildPropertyElements(mainConfig, secretResolver);
        String dbUrl = constructDatabaseURL(realmProperties.get(JDBCRealmConstants.URL));
        realmProperties.put(JDBCRealmConstants.URL, dbUrl);
       
        OMElement adminUser = mainConfig.getFirstChildWithName(new QName(
                UserCoreConstants.RealmConfig.LOCAL_NAME_ADMIN_USER));
        adminUserName = adminUser.getFirstChildWithName(
                new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_USER_NAME)).getText();
        adminPassword = adminUser.getFirstChildWithName(
                new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_PASSWORD)).getText();
        if (secretResolver != null && secretResolver.isInitialized() &&
                secretResolver.isTokenProtected("UserManager.AdminUser.Password")) {
            adminPassword = secretResolver.resolve("UserManager.AdminUser.Password");
        }
        adminRoleName = mainConfig.getFirstChildWithName(
                new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_ADMIN_ROLE)).getText();
        everyOneRoleName = mainConfig.getFirstChildWithName(
                new QName(UserCoreConstants.RealmConfig.LOCAL_NAME_EVERYONE_ROLE)).getText();

        OMElement usaConfig = realmElem.getFirstChildWithName(new QName(
                UserCoreConstants.RealmConfig.LOCAL_NAME_USER_STORE_MANAGER));
        userStoreClass = usaConfig.getAttributeValue(new QName(
                UserCoreConstants.RealmConfig.ATTR_NAME_CLASS));
  userStoreProperties = getChildPropertyElements(usaConfig, secretResolver);
              
        String sIsPasswordExternallyManaged = userStoreProperties
                .get(UserCoreConstants.RealmConfig.LOCAL_PASSWORDS_EXTERNALLY_MANAGED);

        if (null != sIsPasswordExternallyManaged && !sIsPasswordExternallyManaged.trim().equals("")) {
            passwordsExternallyManaged = Boolean.parseBoolean(sIsPasswordExternallyManaged);
        } else {
            if (log.isDebugEnabled()) {
                log.debug("External password management is disabled.");
            }
        }

        OMElement authzConfig = realmElem.getFirstChildWithName(new QName(
                UserCoreConstants.RealmConfig.LOCAL_NAME_ATHZ_MANAGER));
        authorizationManagerClass = authzConfig.getAttributeValue(new QName(
                UserCoreConstants.RealmConfig.ATTR_NAME_CLASS));
        authzProperties = getChildPropertyElements(authzConfig, null);

        realmConfig = new RealmConfiguration();
        realmConfig.setRealmClassName(realmClass);
        realmConfig.setUserStoreClass(userStoreClass);
        realmConfig.setAuthorizationManagerClass(authorizationManagerClass);
        realmConfig.setAdminRoleName(adminRoleName);
        realmConfig.setAdminUserName(adminUserName);
        realmConfig.setAdminPassword(adminPassword);
        realmConfig.setEveryOneRoleName(everyOneRoleName);
        realmConfig.setUserStoreProperties(userStoreProperties);
        realmConfig.setAuthzProperties(authzProperties);
        realmConfig.setRealmProperties(realmProperties);   
        realmConfig.setPasswordsExternallyManaged(passwordsExternallyManaged);
       
        if (realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_MAX_USER_LIST) == null) {
            realmConfig.getUserStoreProperties().put(
                    UserCoreConstants.RealmConfig.PROPERTY_MAX_USER_LIST,
                    UserCoreConstants.RealmConfig.PROPERTY_VALUE_DEFAULT_MAX_COUNT);
        }

        if (realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_READ_ONLY) == null) {
            realmConfig.getUserStoreProperties().put(
                    UserCoreConstants.RealmConfig.PROPERTY_READ_ONLY,
                    UserCoreConstants.RealmConfig.PROPERTY_VALUE_DEFAULT_READ_ONLY);
        }
       
        return realmConfig;
View Full Code Here

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

        if (userRealm != null) {
            return userRealm;
        }
        try {
          if (tenantManager.getTenant(tenantId) != null) {
              RealmConfiguration tenantRealmConfig = (RealmConfiguration) tenantManager.getTenant(
                          tenantId).getRealmConfig();
                  userRealm = initializeRealm(tenantRealmConfig, tenantId);
                  synchronized (this) {
                      userRealmMap.put(Integer.valueOf(tenantId), (UserRealm) userRealm);
                  }
View Full Code Here

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

        synchronized (loadlock) {
            if (isEmailUserName == null) {
                try {
                    if (realmService != null) {
                        UserRealm realm = (UserRealm)realmService.getBootstrapRealm();
                        RealmConfiguration realmConfig = realm.getRealmConfiguration();

                        if (isCrossTenantUniqueUserName == null) {
                            String isUnique = realmConfig
                                    .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_USERNAME_UNIQUE);
                            if ("true".equals(isUnique)) {
                                isCrossTenantUniqueUserName = true;
                            } else {
                                isCrossTenantUniqueUserName = false;
                            }
                        }

                        if (isEmailUserName == null) {
                            String isEmail = realmConfig
                                    .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_IS_EMAIL_USERNAME);
                            if ("true".equals(isEmail)) {
                                isEmailUserName = true;
                            } else {
                                isEmailUserName = false;
                            }
                        }

                        if (domainCalculation == null) {
                            domainCalculation = realmConfig
                                    .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_DOMAIN_CALCULATION);
                            if (domainCalculation == null) {
                                domainCalculation = UserCoreConstants.RealmConfig.PROPERTY_VALUE_DOMAIN_CALCULATION_DEFAULT;
                            }
                        }
View Full Code Here

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

                    new RealmUnawareRegistryCoreServiceComponent();
            comp.setRealmService(ctx.getRealmService());
            comp.registerBuiltInHandlers(embeddedRegistryService);
           
            // get the realm config to retrieve admin username, password
            RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
            registry = embeddedRegistryService.getUserRegistry(
                realmConfig.getAdminUserName(), realmConfig.getAdminPassword());
        } catch (RegistryException e) {
                fail("Failed to initialize the registry. Caused by: " + e.getMessage());
        }
    }
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.