Examples of UserStoreManager


Examples of org.wso2.carbon.user.api.UserStoreManager

            } 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);
        } catch (Exception e) {
View Full Code Here

Examples of org.wso2.carbon.user.api.UserStoreManager

            }
            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.
            throw new UserProfileException(e.getMessage(), e);
        } catch (Exception e) {
View Full Code Here

Examples of org.wso2.carbon.user.api.UserStoreManager

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

            String[] profileNames = ur.getProfileNames(username);
            profiles = new UserProfileDTO[profileNames.length];
            Claim[] claims = getAllSupportedClaims(realm, UserCoreConstants.DEFAULT_CARBON_DIALECT);
            String[] claimUris = new String[claims.length + 1];
            for (int i = 0; i < claims.length; i++) {
                claimUris[i] = claims[i].getClaimUri();
            }

            claimUris[claims.length] = UserCoreConstants.PROFILE_CONFIGURATION;

            for (int i = 0; i < profileNames.length; i++) {
                String profile = profileNames[i];
                Map<String, String> valueMap = ur.getUserClaimValues(username, claimUris, profile);
                ArrayList<UserFieldDTO> userFields = new ArrayList<UserFieldDTO>();
                for (int j = 0; j < claims.length; j++) {
                    UserFieldDTO data = new UserFieldDTO();
                    Claim claim = claims[j];
                    String claimUri = claim.getClaimUri();
View Full Code Here

Examples of org.wso2.carbon.user.api.UserStoreManager

                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;

            if (profileNames != null && profileNames.length > 0) {
                for (int i = 0; i < profileNames.length; i++) {
                    if (profileName.equals(profileNames[i])) {
                        found = true;
                        break;
                    }
                }
            }

            if (!found) {
                return null;
            }

            if (profileAdmin != null) {
                availableProfileConfigurations = getAvailableProfileConfiguration(profileAdmin);
            }

            Claim[] claims = getClaimsToEnterData(realm);
            String[] claimUris = new String[claims.length + 1];
            for (int i = 0; i < claims.length; i++) {
                claimUris[i] = claims[i].getClaimUri();
            }

            claimUris[claims.length] = UserCoreConstants.PROFILE_CONFIGURATION;

            Map<String, String> valueMap = ur.getUserClaimValues(username, claimUris, profileName);
            ArrayList<UserFieldDTO> userFields = new ArrayList<UserFieldDTO>();

            for (int j = 0; j < claims.length; j++) {
                UserFieldDTO data = new UserFieldDTO();
                Claim claim = claims[j];
View Full Code Here

Examples of org.wso2.carbon.user.api.UserStoreManager

        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);
        }
        return userStoreManager.isMultipleProfilesAllowed();
    }
View Full Code Here

Examples of org.wso2.carbon.user.api.UserStoreManager

                                                          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,
                                      new Permission[] { permission });
                }
                userStore.addUser(username, password, new String[]{IdentityConstants.IDENTITY_DEFAULT_ROLE}, null, null);
                IdentityPersistenceManager manager = IdentityPersistenceManager.getPersistanceManager();
                registry = IdentityRPServiceComponent.getRegistryService().getConfigSystemRegistry(tenantId);
                manager.doOpenIdSignUp(registry, userRealm, openId.getOpenID(), username);
                this.addUserClaims(username, firstName, lastName, email, tenantId);
            }
View Full Code Here

Examples of org.wso2.carbon.user.api.UserStoreManager

            claimsMap.put(UserCoreConstants.ClaimTypeURIs.GIVEN_NAME, firstName);
            claimsMap.put(UserCoreConstants.ClaimTypeURIs.SURNAME, lastName);
            claimsMap.put(UserCoreConstants.ClaimTypeURIs.EMAIL_ADDRESS, emailAddress);

            // can be extended to store other user information.
            UserStoreManager userStoreManager =
                                                (UserStoreManager) IdentityRPServiceComponent.getRealmService().
                                                                                              getTenantUserRealm(tenantId).
                                                                                              getUserStoreManager();
            userStoreManager.setUserClaimValues(userName, claimsMap,
                                                UserCoreConstants.DEFAULT_PROFILE);

        } catch (Exception e) {
            String msg = "Error in adding claims to the user.";
            log.error(msg, e);
View Full Code Here

Examples of org.wso2.carbon.user.api.UserStoreManager

        try {
            //TODO - get the realm for a special user that can be used to authorize other users - security team - already talked but need to implement
            UserRealm userRealm =
                    CassandraServerComponentManager.getInstance().getRealmForTenant(authenticatedUser.domainName);
            UserStoreManager userStoreManager = userRealm.getUserStoreManager();
            AuthorizationManager authorizationManager = userRealm.getAuthorizationManager();

            String tenantLessUsername = UserCoreUtil.getTenantLessUsername(authenticatedUser.username);

            switch (action) {
View Full Code Here

Examples of org.wso2.carbon.user.api.UserStoreManager

     * This is used by client decide whether to enable/disable 'Add Profile Configuration'
     * @return
     * @throws ProfileManagementException
     */
    public boolean isAddProfileEnabled() throws ProfileManagementException {
        UserStoreManager userStoreManager = null;
        try {
            UserRealm realm = getRealm();
            userStoreManager = realm.getUserStoreManager();

        } catch (ProfileManagementException e) {
            String errorMessage = "Error obtaining user realm.";
            log.error(errorMessage, e);
            throw new ProfileManagementException(errorMessage, e);

        } catch (UserStoreException e) {
            String errorMessage = "Error obtaining UserStoreManager.";
            log.error(errorMessage, e);
            throw new ProfileManagementException(errorMessage, e);

        }
        return userStoreManager.isMultipleProfilesAllowed();
    }
View Full Code Here

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

        ds.setPassword(dbPassword);

        try {
            RealmConfiguration realmConfig = new RealmConfigXMLProcessor()
                    .buildRealmConfigurationFromFile();
            UserStoreManager userStore = new JDBCUserStoreManager(ds, realmConfig, 0, true);
            userStore.updateCredentialByAdmin(username, password);
            System.out.println("Password updated successfully.");
        } catch (UserStoreException ex) {
            System.err.println("Error updating credentials for user " + username + " : " + ex);
        }
    }
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.