Package org.wso2.carbon.user.core

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


    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);
        isAuthenticated = realm.getUserStoreManager().authenticate(userName, password);
        return isAuthenticated;
    }
View Full Code Here


    private static Log log = LogFactory.getLog(UserProfileAdmin.class);
   
    public boolean isReadOnlyUserStore() throws UserProfileException {
        try {
            UserRealm realm = getUserRealm();
            if ("true".equals(realm.getRealmConfiguration().getUserStoreProperty(
                    UserCoreConstants.RealmConfig.PROPERTY_READ_ONLY))) {
                return true;
            }
            return false;
        } catch (UserStoreException e) {
View Full Code Here

            throw new UserProfileException(e.getMessage(), e);
        }
    }
   
    public void setUserProfile(String username, UserProfileDTO profile) throws UserProfileException {
        UserRealm realm = null;
        try {
            if (!this.isAuthorized(username)) {
                throw new UserProfileException("You are not authorized to perform this action.");
            }

            realm = getUserRealm();

            UserFieldDTO[] udatas = profile.getFieldValues();
            Map<String, String> map = new HashMap<String, String>();
            for (UserFieldDTO data : udatas) {
                String claimURI = data.getClaimUri();
                String value = data.getFieldValue();
                map.put(claimURI, value);
            }

            if (profile.getProfileConifuration() != null) {
                map.put(UserCoreConstants.PROFILE_CONFIGURATION, profile.getProfileConifuration());
            } else {
                map.put(UserCoreConstants.PROFILE_CONFIGURATION,
                        UserCoreConstants.DEFAULT_PROFILE_CONFIGURATION);
            }

            UserStoreManager admin = realm.getUserStoreManager();
            admin.setUserClaimValues(username, map, profile.getProfileName());

        } catch (UserStoreException e) {
            // Not logging. Already logged.
            throw new UserProfileException(e.getMessage(), e);
View Full Code Here

            throw new UserProfileException(e.getMessage(), e);
        }
    }

    public void deleteUserProfile(String username, String profileName) throws UserProfileException {
        UserRealm realm = null;
        try {
            if (!this.isAuthorized(username)) {
                throw new UserProfileException("You are not authorized to perform this action.");
            }

            if (UserCoreConstants.DEFAULT_PROFILE.equals(profileName)) {
                throw new UserProfileException("Cannot delete default profile");
            }
            realm = getUserRealm();

            ClaimManager cman = realm.getClaimManager();
            String[] claims = cman.getAllClaimUris();
            UserStoreManager admin = realm.getUserStoreManager();
            admin.deleteUserClaimValues(username, claims, profileName);
            admin.deleteUserClaimValue(username, UserCoreConstants.PROFILE_CONFIGURATION,
                            profileName);
        } catch (UserStoreException e) {
            // Not logging. Already logged.
View Full Code Here

        try {
            if (!this.isAuthorized(username)) {
                throw new UserProfileException("You are not authorized to perform this action.");
            }

            UserRealm realm = getUserRealm();

            UserStoreManager ur = realm.getUserStoreManager();

            ProfileConfigurationManager profileAdmin = realm
                    .getProfileConfigurationManager();
            if (profileAdmin != null) {
                availableProfileConfigurations = getAvailableProfileConfiguration(profileAdmin);
            }
View Full Code Here

    public UserProfileDTO getProfileFieldsForInternalStore() throws UserProfileException {
        UserFieldDTO[] datas;
        UserProfileDTO profile = new UserProfileDTO();
        String[] availableProfileConfigurations = new String[0];
        try {
            UserRealm realm = getUserRealm();
            Claim[] claims = getClaimsToEnterData(realm);

            ProfileConfigurationManager profileAdmin = realm
                    .getProfileConfigurationManager();
            if (profileAdmin != null) {
                availableProfileConfigurations = getAvailableProfileConfiguration(profileAdmin);
            }
View Full Code Here

            if (!this.isAuthorized(username)) {
                throw new UserProfileException("You are not authorized to perform this action.");
            }

            UserRealm realm = getUserRealm();

            UserStoreManager ur = realm.getUserStoreManager();
            ProfileConfigurationManager profileAdmin = realm
                    .getProfileConfigurationManager();

            String[] profileNames = ur.getProfileNames(username);
            boolean found = false;
View Full Code Here

        }
        return profile;
    }

    public boolean isAddProfileEnabled() throws UserProfileException {
        UserRealm realm = getUserRealm();
        UserStoreManager userStoreManager = null;
        try {
            userStoreManager = realm.getUserStoreManager();
        } catch (UserStoreException e) {
            String errorMessage = "Error in obtaining UserStoreManager.";
            log.error(errorMessage, e);
            throw new UserProfileException(errorMessage, e);
        }
View Full Code Here

        String user = getUserNameFromOpenID(openID.getOpenID());
        String domainName = null;
        if (user != null) {
            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");
View Full Code Here

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

        claimManager = IdentityClaimManager.getInstance();
        realm = IdentityTenantUtil.getRealm(null, null);
        claims = claimManager.getAllSupportedClaims(IdentityConstants.INFOCARD_DIALECT, realm);
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.