Package org.wso2.carbon.user.api

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


    }

    private RealmConfiguration loadDefaultRealmConfigs() throws UserStoreException {
        RealmConfigXMLProcessor processor = new RealmConfigXMLProcessor();
        RealmConfiguration config = processor.buildRealmConfigurationFromFile();
        return config;
    }
View Full Code Here


        }
    }

    public UserStoreInfo getUserStoreInfo() throws UserAdminException {
        try {
            RealmConfiguration realmConfig = realm.getRealmConfiguration();
            UserStoreInfo info = new UserStoreInfo();
            if ("true".equals(realmConfig
                    .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_READ_ONLY))) {
                info.setReadOnly(true);
            } else {
                info.setReadOnly(false);
            }
            info.setPasswordsExternallyManaged(realmConfig.isPasswordsExternallyManaged());
            info.setJsRegEx(realmConfig
                    .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_JS_REG_EX));
            info.setUserNameRegEx(
                realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_USER_NAME_JS_REG_EX));
            info.setRoleNameRegEx(
                realmConfig.getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_ROLE_NAME_JS_REG_EX));
            info.setExternalIdP(realmConfig.
                                           getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_EXTERNAL_IDP));
           
            MessageContext msgContext = MessageContext.getCurrentMessageContext();
            HttpServletRequest request = (HttpServletRequest) msgContext
                    .getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
            HttpSession httpSession = request.getSession(false);
            if (httpSession != null) {
                String userName = (String) httpSession.getAttribute(ServerConstants.USER_LOGGED_IN);
                if (realm.getAuthorizationManager().isUserAuthorized(userName,
                        "/permission/admin/configure/security",
                        CarbonConstants.UI_PERMISSION_ACTION)) {
                    info.setAdminRole(realmConfig.getAdminRoleName());
                    info.setAdminUser(realmConfig.getAdminUserName());
                    info.setEveryOneRole(realmConfig.getEveryOneRoleName());
                    info.setMaxUserListCount(Integer.parseInt(realmConfig
                            .getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_MAX_USER_LIST)));
                }
            }

            info.setBulkImportSupported(this.isBulkImportSupported());
View Full Code Here

                    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());
            systemRegistry = embeddedRegistryService.getSystemRegistry();
            configSystemRegistry = embeddedRegistryService.getConfigSystemRegistry();
            localRepository = embeddedRegistryService.getLocalRepository();
        } catch (RegistryException e){
            fail("Failed to initialize the registry. Caused by: " + e.getMessage());
View Full Code Here

    }

    public void addUser(String userName, String password, String[] roles, ClaimValue[] claims,
            String profileName) throws UserAdminException {
        try {
            RealmConfiguration realmConfig = realm.getRealmConfiguration();
            if (realmConfig.
                           getUserStoreProperty(UserCoreConstants.RealmConfig.PROPERTY_EXTERNAL_IDP) != null) {
                throw new UserAdminException(
                                             "Please contact your extenernal Identity Provider to add users");
            }
            if (roles != null) {
                boolean isContained = false;
                String[] temp = new String[roles.length + 1];
                for (int i = 0; i < roles.length; i++) {
                    temp[i] = roles[i];
                    if (roles[i].equals(realmConfig.getEveryOneRoleName())) {
                        isContained = true;
                        break;
                    }
                }

                if (!isContained) {
                    temp[roles.length] = realmConfig.getEveryOneRoleName();
                    roles = temp;
                }
            }
            UserStoreManager admin = realm.getUserStoreManager();
            Map<String, String> claimMap = new HashMap<String, String>();
View Full Code Here

            RealmUnawareRegistryCoreServiceComponent comp =
                    new RealmUnawareRegistryCoreServiceComponent();
            comp.setRealmService(ctx.getRealmService());
            comp.registerBuiltInHandlers(embeddedRegistryService);

            RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
            registry = embeddedRegistryService.getGovernanceUserRegistry(
                    realmConfig.getAdminUserName(), realmConfig.getAdminPassword());
            configSystemRegistry = embeddedRegistryService.getConfigSystemRegistry();
        } catch (RegistryException e){
            fail("Failed to initialize the registry. Caused by: " + e.getMessage());
        }
    }
View Full Code Here

        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

                    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

                    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

            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

    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

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.