Package org.wso2.carbon.user.core

Examples of org.wso2.carbon.user.core.UserRealm


        IdentityClaimManager claimManager = null;
        Claim[] claims = null;
        List<String> required = null;
        List<String> optional = null;
        OpenIDAuthInfoDTO dto = null;
        UserRealm realm = null;

        claimManager = IdentityClaimManager.getInstance();
        realm = IdentityTenantUtil.getRealm(null, null);
        claims = claimManager.getAllSupportedClaims(dialect, realm);
       
View Full Code Here


     * @throws RegistryException
     */
    public boolean addOpenIdToProfile(OpenIDDTO dto) throws IdentityException, RegistryException {
        String openID = dto.getOpenID();
        String tenantDomain = TenantUtils.getDomainNameFromOpenId(openID);
        UserRealm realm = IdentityTenantUtil.getRealm(tenantDomain, dto.getUserName());

        try {
            if (realm.getUserStoreManager().isExistingUser(dto.getUserName())) {
                if (dto.getPassword() != null) {
                    boolean authenticated =
                                            realm.getUserStoreManager().
                                                  authenticate(dto.getUserName(), dto.getPassword());
                    if (authenticated) {
                        return doOpenIDSignUp(dto.getUserName(), dto.getOpenID());
                    }
                } else {
View Full Code Here

                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);
            }

            userRealm = IdentityTenantUtil.getRealm(domainName, null);
            if (!userRealm.getUserStoreManager().isExistingUser(username)) {
                if (! GOOGLE_APPS_IDP_NAME.equals(userRealm.getRealmConfiguration().
                                                          getUserStoreProperties().
                                                          get(UserCoreConstants.RealmConfig.PROPERTY_EXTERNAL_IDP))) {
                    throw new Exception(
                                        "The domain you are trying to login already exist. If you can prove your rights to this domain please contact administrator.");
                }
                String password = UUIDGenerator.getUUID();
                UserStoreManager userStore = userRealm.getUserStoreManager();
                if (!userStore.isExistingRole(IdentityConstants.IDENTITY_DEFAULT_ROLE)) {
                    Permission permission =
                                            new Permission("/permission/admin/login",
                                                           UserMgtConstants.EXECUTE_ACTION);
                    userStore.addRole(IdentityConstants.IDENTITY_DEFAULT_ROLE, null,
View Full Code Here

     */
    private boolean doOpenIDSignUp(String userName, String openId) throws Exception {
        IdentityPersistenceManager manager = IdentityPersistenceManager.getPersistanceManager();
        String domain = TenantUtils.getDomainNameFromOpenId(openId);
        Registry registry = IdentityTenantUtil.getRegistry(domain, userName);
        UserRealm realm = IdentityTenantUtil.getRealm(domain, userName);
        return manager.doOpenIdSignUp(registry, realm, openId, userName);
    }
View Full Code Here

     */
    public OpenIDProviderInfoDTO getOpenIDProviderInfo(String userName, String openid)
            throws Exception {
        OpenIDProviderInfoDTO providerInfo = null;
        String domain = null;
        UserRealm realm = null;
        providerInfo = new OpenIDProviderInfoDTO();

        try {
            domain = TenantUtils.getDomainNameFromOpenId(openid);
            realm = IdentityTenantUtil.getRealm(domain, userName);
        } catch (Exception ignore) {
            log.error(ignore);
        }
        if (realm == null) {
            return providerInfo;
        }

        providerInfo.setSubDomain(domain);
        userName = UserCoreUtil.getTenantLessUsername(userName);
        providerInfo.setUserExist(realm.getUserStoreManager().isExistingUser(userName));
        providerInfo.setOpenIDProviderServerUrl(IdentityUtil
                .getProperty(ServerConfig.OPENID_SERVER_URL));
        providerInfo.setOpenID(IdentityUtil.getProperty(ServerConfig.OPENID_USER_PATTERN)
                + userName);
        return providerInfo;
View Full Code Here

     * @throws Exception
     */
    public OpenIDUserProfileDTO[] getUserProfiles(String openId, OpenIDParameterDTO[] requredClaims)
            throws Exception {
        String userName = null;
        UserRealm realm = null;
        UserStoreManager reader = null;
        String tenatUser = null;
        String domainName = null;

        try {
            userName = OpenIDUtil.getUserName(openId);
            tenatUser = UserCoreUtil.getTenantLessUsername(userName);

            domainName = TenantUtils.getDomainNameFromOpenId(openId);

            realm = IdentityTenantUtil.getRealm(domainName, userName);
            reader = realm.getUserStoreManager();
            String[] profileNames = reader.getProfileNames(tenatUser);
            OpenIDUserProfileDTO[] profileDtoSet = new OpenIDUserProfileDTO[profileNames.length];

            ParameterList paramList = null;
            AuthRequest authReq = null;
View Full Code Here

        Claim[] claimData = null;
        String[] claimArray = new String[claimList.size()];
        String userName = null;
        String domainName = null;
        String tenatUser;
        UserRealm realm = null;

        userName = OpenIDUtil.getUserName(openId);
        domainName = TenantUtils.getDomainNameFromOpenId(openId);
        tenatUser = UserCoreUtil.getTenantLessUsername(userName);

        realm = IdentityTenantUtil.getRealm(domainName, userName);
        userStore = realm.getUserStoreManager();
        claimValues = userStore.getUserClaimValues(tenatUser, claimList.toArray(claimArray),
                profileId);

        claims = new OpenIDClaimDTO[claimValues.size()];
        int i = 0;
View Full Code Here

            int tenantID = carbonContext.getTenantId();
            String tenantDomain = carbonContext.getTenantDomain();
            String servicePath = RegistryResources.SERVICE_GROUPS
                    + service.getAxisServiceGroup().getServiceGroupName()
                    + RegistryResources.SERVICES + serviceName;
            UserRealm userRealm = AnonymousSessionUtil.getRealmByTenantDomain(
                    SecurityServiceHolder.getRegistryService(), SecurityServiceHolder.getRealmService(), tenantDomain);

            Registry rootRegistry = SecurityServiceHolder.getRegistryService().getRegistry();
            UserRegistry configRegistry = SecurityServiceHolder.getRegistryService().getConfigSystemRegistry(tenantID);
View Full Code Here

    public UserFieldDTO[] readUserFieldsForUserRegistration(String dialect)
            throws IdentityException {
        IdentityClaimManager claimManager = null;
        Claim[] claims = null;
        List<UserFieldDTO> claimList = null;
        UserRealm realm = null;

        claimManager = IdentityClaimManager.getInstance();
        realm = IdentityTenantUtil.getRealm(null, null);
        claims = claimManager.getAllSupportedClaims(dialect, realm);
View Full Code Here

            for (UserFieldDTO userFieldDTO : userFieldDTOs) {
                userClaims.put(userFieldDTO.getClaimUri(), userFieldDTO.getFieldValue());
            }
        }

        UserRealm realm = null;
        realm = IdentityTenantUtil.getRealm(null, null);
        Registry registry = IdentityTenantUtil.getRegistry(null, null);
        addUser(user.getUserName(), user.getPassword(), userClaims, null, realm);

        // OpenId Sign-Up if necessary.
View Full Code Here

TOP

Related Classes of org.wso2.carbon.user.core.UserRealm

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.