Package org.wso2.carbon.user.core.service

Examples of org.wso2.carbon.user.core.service.RealmService


        setupContext();
    }

    protected void setupContext() {
        try {
            RealmService realmService = new InMemoryRealmService();
            is = this.getClass().getClassLoader().getResourceAsStream(
                    System.getProperty("registry.config"));
            ctx = RegistryContext.getBaseInstance(is, realmService);
        } catch (Exception e) {
        }
View Full Code Here



    // Test adding tenants
    private void addTenants() throws RegistryException,
            org.wso2.carbon.user.api.UserStoreException, FileNotFoundException {
        RealmService realmService = ctx.getRealmService();
        TenantManager tenantManager = realmService.getTenantManager();

        String userMgtXML = getUserManagementConfigurationPath();

        RealmConfigXMLProcessor processor = new RealmConfigXMLProcessor();
        RealmConfiguration realmConfig = processor.buildRealmConfiguration(new FileInputStream(
View Full Code Here

    }

    private UserRealm getUserRealm(String username) {
        UserRealm userRealm = null;

        RealmService realmService = AuthenticationServiceDataHolder.getInstance().getRealmService();
        if (null != realmService) {
            try {
                // Get tenant ID
                int tenantID = 0;
                int domainNameSeparatorIndex = username.indexOf(DOMAIN_NAME_SEPARATOR);
                if (-1 != domainNameSeparatorIndex) { // Service case
                    String domainName = username.substring(domainNameSeparatorIndex + 1);
                    tenantID = realmService.getTenantManager().getTenantId(domainName);
                }

                // Get Realm
                userRealm = realmService.getTenantUserRealm(tenantID);
            } catch (org.wso2.carbon.user.api.UserStoreException e) {
                logger.warn("Error while getting tenant user realm for user " + username);
            }
        }
View Full Code Here

    }

    private static UserRealm getUserRealm(String username) {
        UserRealm userRealm = null;

        RealmService realmService = AuthorizationServiceDataHolder.getInstance().getRealmService();
        if (null != realmService) {
            try {
                // Get tenant ID
                int tenantID = 0;
                int domainNameSeparatorIndex = username.indexOf(DOMAIN_NAME_SEPARATOR);
                if (-1 != domainNameSeparatorIndex) { // Service case
                    String domainName = username.substring(domainNameSeparatorIndex + 1);
                    tenantID = realmService.getTenantManager().getTenantId(domainName);
                }

                // Get Realm
                userRealm = realmService.getTenantUserRealm(tenantID);
            } catch (UserStoreException e) {
                logger.warn("Error while getting tenant user realm for user " + username);
            } catch (NullPointerException e) {
                logger.error("Error while accessing the realm service : " + e.getMessage());
            }
View Full Code Here

        String carbonXMLPath = carbonHome + File.separator + "repository"
                + File.separator + "conf" + File.separator + "carbon.xml";
        RegistryConfiguration regConfig = new RegistryConfiguration(carbonXMLPath);
        RegistryCoreServiceComponent.setRegistryConfig(regConfig);

        RealmService realmService = new InMemoryRealmService();
        InputStream is;

        try {
            is = this.getClass().getClassLoader().getResourceAsStream(
                    "registry.xml");
View Full Code Here

        s.start();
    }

    public void start() throws Exception {

        RealmService realmService = new InMemoryRealmService();
        RegistryContext regContext = RegistryContext.getBaseInstance(realmService);
        regContext.selectDBConfig("in-memory");
        //RegistryContext.setSingleton(regContext);

        server = new Server(port);
View Full Code Here

    }

    public static Registry getUnchrootedSystemRegistry(RequestContext requestContext)
            throws RegistryException {
        Registry registry = requestContext.getRegistry();
        RealmService realmService = registry.getRegistryContext().getRealmService();
        String systemUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;

        return new UserRegistry(systemUser, CurrentSession.getTenantId(), registry,
                realmService, null);
    }
View Full Code Here

        String carbonXMLPath = carbonHome + File.separator + "repository"
                + File.separator + "conf" + File.separator + "carbon.xml";
        RegistryConfiguration regConfig = new RegistryConfiguration(carbonXMLPath);
        RegistryCoreServiceComponent.setRegistryConfig(regConfig);

        RealmService realmService = new InMemoryRealmService();
        InputStream is;

        try {
            is = this.getClass().getClassLoader().getResourceAsStream(
                    "registry.xml");
View Full Code Here

        boolean isDomainAvailable = TenantCoreUtil.isDomainNameAvailable(tenant);
        if (!isDomainAvailable) {
            throw new Exception("Domain is not available to register");
        }

        RealmService realmService = TenantMgtCoreServiceComponent.getRealmService();
        RealmConfiguration realmConfig = realmService.getBootstrapRealmConfiguration();
        TenantMgtConfiguration tenantMgtConfiguration = realmService.getTenantMgtConfiguration();
        MultiTenantRealmConfigBuilder builder =
                                                TenantMgtCoreServiceComponent.getRealmService()
                                                                             .
                                                                              getMultiTenantRealmConfigBuilder();
        RealmConfiguration realmConfigToPersist =
View Full Code Here

        return tenantId;
    }

    private void doPostTenantCreationActions(Tenant tenant, String originatedService)
                                                                                    throws Exception {
        RealmService realmService = TenantMgtCoreServiceComponent.getRealmService();
        UserRealm userRealm = null;
        try {
            userRealm = (UserRealm) realmService.getTenantUserRealm(tenant.getId());
        } catch (UserStoreException e) {
            String msg = "Error in creating Realm for tenant: " + tenant.getDomain();
            throw new Exception(msg, e);
        }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.core.service.RealmService

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.