Examples of RealmService


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

    }

    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

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

        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

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

        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

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

    }

    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

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

        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

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

        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

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

        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

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

            String msg = "Error in retrieving the tenant information for the tenant id: " +
                         tenantId + ".";
            log.info(msg, e);
            throw new Exception(msg, e);
        }
        RealmService realmService = Util.getRealmService();
        try {
            Map<String, String> claimsMap = new HashMap<String, String>();
            claimsMap.put(UserCoreConstants.ClaimTypeURIs.GIVEN_NAME,
                          accountInfoBean.getFirstname());
            claimsMap.put(UserCoreConstants.ClaimTypeURIs.SURNAME, accountInfoBean.getLastname());
            UserStoreManager userStoreManager =
                    (UserStoreManager) realmService.getTenantUserRealm(tenantId)
                            .getUserStoreManager();
            userStoreManager.setUserClaimValues(
                    ClaimsMgtUtil.getAdminUserNameFromTenantId(realmService, tenantId),
                    claimsMap, UserCoreConstants.DEFAULT_PROFILE);
            log.info("FirstName: " + accountInfoBean.getFirstname() +
View Full Code Here

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

        String ksName = tenantDomain.trim().replace(".", "-");
        return (ksName + ".jks" );
    }

    private String getTenantDomainName() throws KeyStoreMgtException {
        RealmService realmService = RealmServiceHolder.getRealmService();
        if (realmService == null) {
            String msg = "Error in getting the domain name, realm service is null.";
            log.error(msg);
            throw new KeyStoreMgtException(msg);
        }
        try {
            return realmService.getTenantManager().getDomain(tenantId);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            String msg = "Error in getting the domain name for the tenant id: " + tenantId;
            log.error(msg, e);
            throw new KeyStoreMgtException(msg, e);
        }
View Full Code Here

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

            String tenantDomain = UserCoreUtil.getTenantDomain(OAuthServiceComponent
                    .getRealmService(), oauthConsumer.getOauthConsumerKey());
            RegistryService registryService = OAuthServiceComponent.getRegistryService();
            String username = UserCoreUtil.getTenantLessUsername(oauthConsumer
                    .getOauthConsumerKey());
            RealmService realmService = OAuthServiceComponent.getRealmService();
            int tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
            UserRealm realm = registryService.getUserRealm(tenantId);
            int userId = realm.getUserStoreManager().getUserId(username);

            String baseString = "TenantId:=" + tenantId + "&UserId:=" + userId;
            Registry registry = registryService.getConfigSystemRegistry(tenantId);
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.