Examples of RealmService


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

       
    }

    public void handle(Callback[] callbacks) throws IOException, UnsupportedCallbackException {
        try {
            RealmService realmService = IdentitySTSServiceComponent.getRealmService();
            for (int i = 0; i < callbacks.length; i++) {

                if (callbacks[i] instanceof WSPasswordCallback) {
                    WSPasswordCallback pwcb = (WSPasswordCallback) callbacks[i];
                    String username = pwcb.getIdentifer();
View Full Code Here

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

        }
    }

    public boolean authenticateUser(String userName, String password) throws CarbonException,
            UserStoreException {
        RealmService realmService = IdentitySTSServiceComponent.getRealmService();
        RegistryService registryService = IdentitySTSServiceComponent.getRegistryService();
        boolean isAuthenticated = false;
        UserRealm realm = AnonymousSessionUtil.getRealmByUserName(registryService, realmService,
                userName);
        userName = UserCoreUtil.getTenantLessUsername(userName);
View Full Code Here

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

            domainName = TenantUtils.getDomainNameFromOpenId(openID.getOpenID());
        }
        UserRealm userRealm = IdentityTenantUtil.getRealm(domainName, user);
        Registry registry = IdentityTenantUtil.getRegistry(domainName, user);

        RealmService realmService = IdentityRPServiceComponent.getRealmService();

        if (user != null && userRealm.getUserStoreManager().isExistingUser(user)) {
            this.onUserLogin(user, domainName, httpSess);
            dto.setAuthenticated(true);
            dto.setUserID(user);
            CarbonAuthenticationUtil.onSuccessAdminLogin(httpSess, user,
                                                         realmService.getTenantManager().
                                                                      getTenantId(domainName),
                                                         domainName, "Info card login");
        } else {
            // external parties
            IdentityPersistenceManager persistentManager =
                                                           IdentityPersistenceManager.
                                                                                      getPersistanceManager();
            if (persistentManager.hasSignedUpForOpenId(registry, userRealm, openID.getOpenID())) {
                user = persistentManager.getUserIdForOpenIDSignUp(registry, userRealm,
                                                                  openID.getOpenID());
                if (userRealm.getUserStoreManager().isExistingUser(user)) {
                    CarbonAuthenticationUtil.onSuccessAdminLogin(httpSess,
                                                                 user,
                                                                 realmService.getTenantManager().getTenantId(domainName),
                                                                 domainName,
                                                                 "Info card login");
                    dto.setAuthenticated(true);
                    dto.setUserID(user);
                }
View Full Code Here

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

            if (username == null) {
                log.error("The username is null");
                throw new Exception("The username is null");
            }

            RealmService realmService = IdentityRPServiceComponent.getRealmService();
            UserRealm userRealm = null;
            Registry registry = null;
            int tenantId = realmService.getTenantManager().getTenantId(domainName);

            if (tenantId == -1) {
                tenantId = this.createTenant(domainName, email, username, firstName, lastName);
            }
View Full Code Here

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

     * @throws RegistryException if the operation failed.
     */
    public static Registry getSystemRegistry(Registry coreRegistry)
            throws RegistryException {

        RealmService realmService = coreRegistry.getRegistryContext().getRealmService();
        String systemUser = CarbonConstants.REGISTRY_SYSTEM_USERNAME;

        if (systemUser.equals(CurrentSession.getUser())) {
            return CurrentSession.getUserRegistry();
        }
View Full Code Here

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

        return getTenantIdFromDomain(domain);
    }

    private static int getTenantIdFromDomain(String domain) throws RegistryException {
        RegistryContext registryContext = RegistryContext.getBaseInstance();
        RealmService realmService = registryContext.getRealmService();
        if (realmService == null) {
            String msg = "Error in getting the tenant manager. The realm service is not available.";
            log.error(msg);
            throw new RegistryException(msg);
        }
        TenantManager tenantManager = realmService.getTenantManager();
        try {
            return tenantManager.getTenantId(domain);
        } catch (org.wso2.carbon.user.api.UserStoreException e) {
            String msg = "Error in getting the tenant manager.";
            log.error(msg, e);
View Full Code Here

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

        SecurityManager secMan = System.getSecurityManager();
        if(secMan != null){
           secMan.checkPermission(new ManagementPermission("control"));
        }
        try {
            RealmService realmService = new DefaultRealmService(bundleContext);
            bundleContext.registerService(RealmService.class.getName(), realmService, null);
            DatabaseUtil.logDatabaseConnections();
            UserCoreUtil.setRealmService(realmService);
        } catch (Throwable e) {
            String msg = "Cannot start User Manager Core bundle";
View Full Code Here

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

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


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

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

    }

    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
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.