Examples of RealmConfiguration


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

    protected static Registry originalRegistry = null;

    public void setUp() {
        super.setUp();
        try {
            RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
            originalRegistry =
                    embeddedRegistryService.getUserRegistry(realmConfig.getAdminUserName());
            registry = embeddedRegistryService.getUserRegistry(realmConfig.getAdminUserName(), 0,
                    "/basePrefix");
            systemRegistry = embeddedRegistryService.getSystemRegistry(0, "/basePrefix");
        } 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

                                                               TenantMgtConfiguration
                                                                       tenantMgtConfiguration,
                                                               Tenant tenantInfo, int tenantId)
            throws UserStoreException {
        try {
            RealmConfiguration realmConfig = (RealmConfiguration)bootStrapConfig.cloneRealmConfiguration();
            // TODO :: Random password generation
            realmConfig.setAdminPassword(UUIDGenerator.getUUID());
            realmConfig.setAdminUserName(tenantInfo.getAdminName());
            realmConfig.setTenantId(tenantId);
            Map<String, String> authz = realmConfig.getAuthzProperties();
            authz.put(UserCoreConstants.RealmConfig.PROPERTY_ADMINROLE_AUTHORIZATION,
                    CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION);
            realmConfig.getRealmProperties().remove(JDBCRealmConstants.DRIVER_NAME);
            realmConfig.getRealmProperties().remove(JDBCRealmConstants.URL);
            realmConfig.getRealmProperties().remove(JDBCRealmConstants.USER_NAME);
            realmConfig.getRealmProperties().remove(JDBCRealmConstants.PASSWORD);
            realmConfig.getRealmProperties().remove(JDBCRealmConstants.MAX_ACTIVE);
            realmConfig.getRealmProperties().remove(JDBCRealmConstants.MIN_IDLE);
            realmConfig.getRealmProperties().remove(JDBCRealmConstants.MAX_WAIT);
           
            return realmConfig;
        } catch (Exception e) {
            log.error(e.getMessage(), e);
            throw new UserStoreException(e.getMessage(), e);
View Full Code Here

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

     */
    public RealmConfiguration getRealmConfigForTenantToPersist(RealmConfiguration
            bootStrapConfig, TenantMgtConfiguration tenantMgtConfiguration, Tenant tenantInfo,
                                                               int tenantId)
            throws UserStoreException {
        RealmConfiguration ldapRealmConfig = null;
        try {
            ldapRealmConfig = bootStrapConfig.cloneRealmConfiguration();
            //TODO: Random password generation.
            ldapRealmConfig.setAdminPassword(UIDGenerator.generateUID());
            ldapRealmConfig.setAdminUserName(tenantInfo.getAdminName());
            ldapRealmConfig.setTenantId(tenantId);

            Map<String, String> authz = ldapRealmConfig.getAuthzProperties();
            authz.put(UserCoreConstants.RealmConfig.PROPERTY_ADMINROLE_AUTHORIZATION,
                      CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION);

            Map<String, String> userStoreProperties = ldapRealmConfig.getUserStoreProperties();

            //If the domain is wso2.com, partition dn is composed as dc=wso2,dc=com as follows:
            String partitionDN = "dc=" + tenantInfo.getDomain().split("\\.")[0] + ",dc=" +
                                 tenantInfo.getDomain().split("\\.")[1];
            /*according to carbon/components/apacheds-server, users are stored under "ou=Users"
View Full Code Here

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

                }
            }

            try {
                AuthorizationManager ac = systemRegistry.getUserRealm().getAuthorizationManager();
                RealmConfiguration realmConfig;
                realmConfig = registryContext.getRealmService().getBootstrapRealmConfiguration();
                String systemUserName = CarbonConstants.REGISTRY_SYSTEM_USERNAME;


                ac.clearResourceAuthorizations("/system");

                ac.authorizeUser(systemUserName, "/system", ActionConstants.GET);
                ac.authorizeUser(systemUserName, "/system", ActionConstants.PUT);
                ac.authorizeUser(systemUserName, "/system", ActionConstants.DELETE);
                ac.authorizeUser(systemUserName, "/system", AccessControlConstants.AUTHORIZE);

                String adminUserName = CarbonConstants.REGISTRY_SYSTEM_USERNAME;

                ac.authorizeUser(adminUserName, "/system", ActionConstants.GET);

                String adminRoleName = realmConfig.getAdminRoleName();
                ac.authorizeRole(adminRoleName, "/system", ActionConstants.GET);

                // any user should be able to execute auto generated queries, though the results
                // of such queries are filtered to match current users permission level.
                String everyoneRoleName = realmConfig.getEveryOneRoleName();
                ac.authorizeRole(everyoneRoleName,
                        "/system/queries/advanced", ActionConstants.GET);

            } catch (UserStoreException e) {
                String msg = "Failed to set permissions for the system collection.";
View Full Code Here

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

                                                               TenantMgtConfiguration tenantMgtConfig,
                                                               Tenant tenantInfo, int tenantId)
            throws UserStoreException {

        try {
            RealmConfiguration ldapRealmConfig = bootStrapConfig.cloneRealmConfiguration();
            ldapRealmConfig.setAdminPassword(UIDGenerator.generateUID());
            ldapRealmConfig.setAdminUserName(tenantInfo.getAdminName());
            ldapRealmConfig.setTenantId(tenantId);

            Map<String, String> authz = ldapRealmConfig.getAuthzProperties();
            authz.put(UserCoreConstants.RealmConfig.PROPERTY_ADMINROLE_AUTHORIZATION,
                      CarbonConstants.UI_ADMIN_PERMISSION_COLLECTION);

            Map<String, String> userStoreProperties = ldapRealmConfig.getUserStoreProperties();

            String partitionDN = tenantMgtConfig.getTenantStoreProperties().get(
                    UserCoreConstants.TenantMgtConfig.PROPERTY_ROOT_PARTITION);
            String organizationName = tenantInfo.getDomain();
            //eg: o=cse.rog
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 adminRoleName = realmConfig.getAdminRoleName();
            String everyoneRoleName = realmConfig.getEveryOneRoleName();

            accessControlAdmin.authorizeRole(adminRoleName, rootPath,
                    ActionConstants.GET);
            accessControlAdmin.authorizeRole(adminRoleName, rootPath,
                    ActionConstants.PUT);
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.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

    }

    // Test each registry has different virtual roots
    public void testVirtualRoots() throws Exception {

        RealmConfiguration realmConfig = ctx.getRealmService().getBootstrapRealmConfiguration();
        UserRegistry registry1 =
                embeddedRegistryService.getUserRegistry(realmConfig.getAdminUserName(), 0);
        Resource r = registry1.newResource();
        registry1.put("/test", r);

        r = registry1.get("/");
        r.addProperty("name", "value");
        registry1.put("/", r);

        UserRegistry registry2 =
                embeddedRegistryService.getUserRegistry(realmConfig.getAdminUserName(), 1);
        r = registry2.get("/");
        Properties p = r.getProperties();
        assertEquals("The properties in the second registry should be 0", p.size(), 0);

        boolean notExist = false;
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.