Package org.wso2.carbon.user.api

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


     * 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

     * 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

    }

    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

    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

    private static Log log = LogFactory.getLog(DirectoryServerManager.class);

    private LDAPServerStoreManager getServerStoreManager() throws DirectoryServerManagerException {
        UserRealm realm = this.getUserRealm();
        RealmConfiguration configuration;
        try {
            configuration = realm.getRealmConfiguration();
        } catch (UserStoreException e) {
            throw new DirectoryServerManagerException("Unable to retrieve realm configuration.");
        }
View Full Code Here

     * @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);
View Full Code Here

     * @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);
View Full Code Here

public class UserRealmService extends AbstractAdmin {

    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;
    }
View Full Code Here

     * @return true if KDC is enabled, else false.
     * @throws DirectoryServerManagerException If an error occurred while querying user realm.
     */
    public boolean isKDCEnabled() throws DirectoryServerManagerException {
       try {
            RealmConfiguration userStoreConfigurations = this.getUserRealm().getRealmConfiguration();
            if (userStoreConfigurations != null) {
                String isKDCEnabled = userStoreConfigurations.getUserStoreProperty
                        (UserCoreConstants.RealmConfig.PROPERTY_KDC_ENABLED);

                return isKDCEnabled != null && Boolean.parseBoolean(isKDCEnabled);

            }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.api.RealmConfiguration

Copyright © 2018 www.massapicom. 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.