Package org.wso2.carbon.user.api

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


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

            embeddedRegistryService = ctx.getEmbeddedRegistryService();
            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

    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

                    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

                                                               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

     */
    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

                }
            }

            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

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.