Package org.apache.jetspeed.services.security

Examples of org.apache.jetspeed.services.security.UserException


            TurbineUserPeer.doUpdate(criteria);
        }
        catch(Exception e)
        {
            logger.error( "Failed to save user object ", e );
            throw new UserException("Failed to save user object ", e);
        }

    }
View Full Code Here


        }
        catch(Exception e)
        {
            String message = "Failed to create account '" + user.getUserName() + "'";
            logger.error( message, e );
            throw new UserException( message, e );
        }

        addDefaultPSML(user);
    }
View Full Code Here

        }
        catch (Exception e)
        {
            logger.error( "Failed to create profile for new user ", e );
            removeUser(new UserNamePrincipal(user.getUserName()));
            throw new UserException("Failed to create profile for new user ", e);
        }
    }
View Full Code Here

    public void removeUser(Principal principal)
        throws JetspeedSecurityException
    {
        if (systemUsers.contains(principal.getName()))
        {
            throw new UserException("[" + principal.getName() + "] is a system user and cannot be removed");
        }

        JetspeedUser user = getUser(principal);

        Criteria criteria = new Criteria();
        if (principal instanceof UserNamePrincipal)
        {
            criteria.add(TurbineUserPeer.LOGIN_NAME, principal.getName());
        }
        else if (principal instanceof UserIdPrincipal)
        {
            criteria.add(TurbineUserPeer.USER_ID, principal.getName());
        }
        else
        {
            throw new UserException("Invalid Principal Type in removeUser: " + principal.getClass().getName());
        }

        try
        {
            TurbineUserPeer.doDelete(criteria);
            PsmlManager.removeUserDocuments(user);
        }
        catch(Exception e)
        {
            String message = "Failed to remove account '" + user.getUserName() + "'";
            logger.error( message, e );
            throw new UserException( message, e );
        }

    }
View Full Code Here

        {
            throw new UnknownUserException(Localization.getString("UPDATEACCOUNT_NOUSER"));
        }
        if(!user.getPassword().equals(encrypted))
        {
            throw new UserException(Localization.getString("UPDATEACCOUNT_BADOLDPASSWORD"));
        }
        user.setPassword(JetspeedSecurity.encryptPassword(newPassword));

        // Set the last password change date
        user.setPasswordChanged(new Date());
View Full Code Here

            users = TurbineUserPeer.doSelect(criteria);
        }
        catch(Exception e)
        {
            logger.error( "Failed to check account's presence", e );
            throw new UserException(
                "Failed to check account's presence", e);
        }
        if (users.size() < 1)
        {
            return false;
        }
        TurbineUser retrieved = (TurbineUser)users.get(0);
        int key = retrieved.getUserId();
        String keyId = String.valueOf(key);
        if (checkUniqueId && !keyId.equals(id))
        {
            throw new UserException("User exists but under a different unique ID");
        }
        return true;
    }
View Full Code Here

   
        if (create)
        {
            ldapurl = JetspeedLDAP.buildURL("uid=" + (String)getPerm(User.USERNAME) + ",ou=users");
            setutil(ATTR_UID, (String)getPerm(User.USERNAME));
            if (JetspeedLDAP.addEntry(ldapurl, myAttrs) == false) throw new UserException("Could not insert user data to LDAP!");
        }
        else if (JetspeedLDAP.exists(ldapurl))
        {
            JetspeedLDAP.deleteAttrs(ldapurl, rmAttrs);
            if (JetspeedLDAP.updateEntry(ldapurl, myAttrs) == false) throw new UserException("Could not update user data to LDAP!");
        }
    }
View Full Code Here

                       "(&(uid="+principal.getName()+")(objectclass=jetspeeduser))", ATTRS, true);
        }
        catch (Exception e)
        {
            logger.error( "Failed to retrieve user '" + principal.getName() + "'", e );
            throw new UserException("Failed to retrieve user '" + principal.getName() + "'", e);
        }
        
        if (userurls.size() == 1)
        {
            user = new LDAPUser((LDAPURL) ((Vector)userurls.elementAt(0)).firstElement());
            return user;
        }
        else if(userurls.size() > 1)
        {
            throw new UserException("Multiple Users with same username '" + principal.getName() + "'");
        }
        else
        {
            throw new UnknownUserException("Unknown user '" + principal.getName() + "'");
        }
View Full Code Here

            JetspeedLDAP.getService().checkAndCloseContext(ctx);
        }
        catch ( Exception e )
        {
            logger.error( "Failed to retrieve user with filter:" + filter, e );
            throw new UserException( "Failed to retrieve user with filter:" + filter, e );
        }

        return ( resultList.iterator() );
    }
View Full Code Here

            ((LDAPUser)user).update(false);
        }
        catch(Exception e)
        {
            logger.error( "Failed to save user object ", e);
            throw new UserException("Failed to save user object ", e);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.jetspeed.services.security.UserException

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.