Examples of RealmService


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

    public static int getTenantID(String tenantDomain) throws BAMException {

        int tenantID = CarbonConstants.SUPER_TENANT_ID;
        if (tenantDomain != null) {
            RealmService realmService = BAMUtil.getRealmService();
            try {
                tenantID = realmService.getTenantManager().getTenantId(tenantDomain);
            } catch (org.wso2.carbon.user.api.UserStoreException e) {
                throw new BAMException("Can not tenant manager");
            }
        }
        return tenantID;
View Full Code Here

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

                .getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);

        HttpSession httpSession = request.getSession(false);
        String userName = DBUtils.getUsername(msgContext);
       
        RealmService realmService = DataServicesDSComponent.getRealmService();
        RegistryService registryService = DataServicesDSComponent.getRegistryService();

        /* if session does not exist, return empty array of roles */
        if (httpSession == null) {
          return new String[0];
        }

        /* first return the tenant id from the tenant domain */
        SuperTenantCarbonContext carbonContext = SuperTenantCarbonContext.getCurrentContext(httpSession);
    String tenantDomain = carbonContext.getTenantDomain();
        int tenantId = carbonContext.getTenantId();
        if (tenantId < 0) {
            tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
        }
        if (tenantId < 0) {
            /* the tenant doesn't exist. */
            log.error("The tenant doesn't exist. Tenant domain:" + tenantDomain);
            throw new DataServiceFault("Access Denied. You are not authorized.");
        }
        if (!realmService.getTenantManager().isTenantActive(tenantId)) {
            /* the tenant is not active. */
            log.error("The tenant is not active. Tenant domain:" + tenantDomain);
            throw new DataServiceFault("The tenant is not active. Tenant domain:" + tenantDomain);
        }
        UserRealm realm;
View Full Code Here

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

            }
        }
    }
   
    private void doEventRealmInitiliased() {
      RealmService realmService = DataServicesDSComponent.getRealmService();
      try {
            SuperTenantCarbonContext.getCurrentContext().setUserRealm(realmService.getBootstrapRealm());
            SuperTenantCarbonContext.getCurrentContext().setUsername(CarbonConstants.REGISTRY_SYSTEM_USERNAME);
      } catch (Exception e) {
      log.error(e.getMessage(), e);
    }
      this.notifyEventServiceListeners();
View Full Code Here

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

      throws DeploymentException {
    /* set the thread local variable to hold the tenant id */
    try {
            int tenantId = SuperTenantCarbonContext.getCurrentContext(this.configCtx).getTenantId();
            SuperTenantCarbonContext.getCurrentContext().setTenantId(tenantId);
            RealmService realmService = DataServicesDSComponent.getRealmService();
            if (realmService != null) {
                try {
          SuperTenantCarbonContext.getCurrentContext().setUserRealm(realmService.getBootstrapRealm());
        } catch (UserStoreException e) {
          throw new DeploymentException(e);
        }
            }
            SuperTenantCarbonContext.getCurrentContext().setUsername(CarbonConstants.REGISTRY_SYSTEM_USERNAME);
View Full Code Here

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

    public static X509CredentialImpl getX509CredentialImplForTenant(String domainName, String alias)
            throws IdentitySAML2SSOException {

        int tenantID = 0;
        RegistryService registryService = SAMLSSOUtil.getRegistryService();
        RealmService realmService = SAMLSSOUtil.getRealmService();

        // get the tenantID
        if (domainName != null) {
            try {
                tenantID = realmService.getTenantManager().getTenantId(domainName);
            } catch (org.wso2.carbon.user.api.UserStoreException e) {
                String errorMsg = "Error getting the TenantID for the domain name";
                log.error(errorMsg, e);
                throw new IdentitySAML2SSOException(errorMsg, e);
            }
View Full Code Here

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

     *
     * @return tenant manager.
     */
    private TenantManager getTenantManager() {
        try {
            RealmService realmService = dataHolder.getRealmService();
            if (realmService != null) {
                return realmService.getTenantManager();
            }
        } catch (Exception ignored) {
            // We don't mind any exception occurring here. Our intention is provide a tenant manager
            // here. It is perfectly valid to not have a tenant manager in some situations.
        }
View Full Code Here

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

            HttpService httpService = dataHolder.getHttpService();
            HttpContext defaultHttpContext = httpService.createDefaultHttpContext();

            registerCarbonServlet(httpService, defaultHttpContext);

            RealmService realmService = dataHolder.getRealmService();
            UserRealm teannt0Realm = realmService.getBootstrapRealm();
            CarbonJMXAuthenticator.setUserRealm(teannt0Realm);

            log.info("Repository       : " + axis2RepoLocation);

            //Registering the configuration contexts as an OSGi service.
View Full Code Here

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

                    }
                }
                String tenantAwareUsername = UserCoreUtil.getTenantLessUsername(userName);
                String tenantDomain;
                try {
                    RealmService realmService = ServerAdminDataHolder.getInstance()
                            .getRealmService();
                    tenantDomain = UserCoreUtil.getTenantDomain(realmService, userName);
                } catch (UserStoreException e) {
                    log.error("Unable to find the tenant domain :" + e.getMessage(), e);
                    throw new AuthenticationException("Unable to find the tenant domain", e);
View Full Code Here

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

            e.printStackTrace();
        }
    }
   
    public RealmService getRealmService() throws Exception{
        RealmService realmService  = null;
        if(dlgtRealmTracker != null){
            realmService = (RealmService)dlgtRealmTracker.getService();
        }
       
        if(realmService == null){
View Full Code Here

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

                        remoteAddress, "Data");
                return false;
            }

            RegistryService registryService = CarbonServicesServiceComponent.getRegistryService();
            RealmService realmService = CarbonServicesServiceComponent.getRealmService();

            String tenantDomain = UserCoreUtil.getTenantDomain(realmService, username);
            int tenantId = realmService.getTenantManager().getTenantId(tenantDomain);
            handleAuthenticationStarted(tenantId);
            String userNameWithDomain = username;
            username = UserCoreUtil.getTenantLessUsername(username);
            UserRealm realm = AnonymousSessionUtil.getRealmByTenantDomain(registryService,
                    realmService, tenantDomain);
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.