Examples of UserRealm


Examples of org.mortbay.jetty.security.UserRealm

        {
            SecurityHandler.NotChecked not_checked=(SecurityHandler.NotChecked)_userPrincipal;
            _userPrincipal = SecurityHandler.__NO_USER;
           
            Authenticator auth=not_checked.getSecurityHandler().getAuthenticator();
            UserRealm realm=not_checked.getSecurityHandler().getUserRealm();
            String pathInContext=getPathInfo()==null?getServletPath():(getServletPath()+getPathInfo());
           
            if (realm != null && auth != null)
            {
                try
View Full Code Here

Examples of org.openqa.jetty.http.UserRealm

        {
            if (_requireName==null)
                return true;

            // Authenticate with realm
            UserRealm realm=context.getRealm();
            Principal principal=realm==null?null:realm.authenticate(user,pass,request);
            if (principal==null)
            {
                // Have to authenticate the user with the password file
                String code=getUserCode(user);
                String salt=code!=null?code.substring(0,2):user;
View Full Code Here

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

        try {
            int tenantID = 0;
            if (username.contains("@")) {
                tenantID = realmService.getTenantManager().getTenantId(username.substring(username.lastIndexOf("@") + 1));
            }
            UserRealm userRealm = realmService.getTenantUserRealm(tenantID);

            // User not found in the UM
            if (!userRealm.getUserStoreManager().isExistingUser(tenantLessUsername)) {
                throw new AuthenticationException("Invalid User : " + tenantLessUsername, log);
            }

            // Authenticate internal call from another Carbon bundle
            if (password.equals(sharedKeyAccessService.getSharedKey())) {
                return true;
            }

            // Check if the user is authenticated
            return userRealm.getUserStoreManager().authenticate(tenantLessUsername, password);

            // Let the engine know if the user is authenticated or not
        } catch (UserStoreException e) {
            throw new AuthenticationException("User not authenticated for the given username : " + tenantLessUsername, log);
        }
View Full Code Here

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

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

    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

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

            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

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

            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

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

        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

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

    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

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

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