Examples of RealmService


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

    public static X509CredentialImpl getX509CredentialImplForTenant(String domainName)
            throws SAML2SSOAuthenticatorException {

        int tenantID = 0;
        RegistryService registryService = SAML2SSOAuthBEDataHolder.getInstance().getRegistryService();
        RealmService realmService = SAML2SSOAuthBEDataHolder.getInstance().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 SAML2SSOAuthenticatorException(errorMsg, e);
            }
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

            log.error("username or password is seen as null/empty values.");
            return Response.status(Response.Status.UNAUTHORIZED).header("WWW-Authenticate", "Basic").
                    type(MediaType.APPLICATION_JSON).entity(Utils.buildMessage("Username/Password cannot be null")).build();
        }
        try {
            RealmService realmService = ServiceHolder.getRealmService();
            RegistryService registryService = ServiceHolder.getRegistryService();
            String tenantDomain = MultitenantUtils.getTenantDomain(username);
            int tenantId = realmService.getTenantManager().getTenantId(tenantDomain);

            UserRealm userRealm = AnonymousSessionUtil.getRealmByTenantDomain(registryService, realmService, tenantDomain);
            if (userRealm == null) {
                log .error("Invalid domain or unactivated tenant login");
                // is this the correct HTTP code for this scenario ? (401)
View Full Code Here

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

        boolean isDomainAvailable = CommonUtil.isDomainNameAvailable(tenantDomain);
        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 =
                builder.getRealmConfigForTenantToPersist(realmConfig, tenantMgtConfiguration,
                        tenant, -1);
View Full Code Here

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

     *
     * @param tenant - the tenant
     * @throws Exception - UserStoreException
     */
    private void updateTenantAdminPassword(Tenant tenant) throws Exception {
        RealmService realmService = TenantMgtCoreServiceComponent.getRealmService();
        UserRealm userRealm;
        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);
        }
        try {
View Full Code Here

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

public class ServiceHolder {
    private static Log log = LogFactory.getLog(ServiceHolder.class);

    public static TenantManager getTenantManager() {
        PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        RealmService realmService = (RealmService)carbonContext.getOSGiService(RealmService.class);
        return realmService.getTenantManager();
    }
View Full Code Here

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

        return tenantBillingService;
    }

    public static RealmService getRealmService(){
        PrivilegedCarbonContext carbonContext = PrivilegedCarbonContext.getThreadLocalCarbonContext();
        RealmService realmService = (RealmService)carbonContext.getOSGiService(RealmService.class);
        return realmService;
    }
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.