Package org.apache.jetspeed.services.security

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


        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


                userClassName = serviceConf.getString(CONFIG_USER_CLASSNAME);                                                            
                userClass = Class.forName(userClassName);
            }
            catch(Exception e)
            {
                throw new UserException(
                    "JetspeedUserFactory: Failed to create a Class object for User implementation: " + e.toString());
            }
        }

        try
        {
            user = (JetspeedUser)userClass.newInstance();
            if (user instanceof BaseJetspeedUser)
            {
                ((BaseJetspeedUser)user).setNew(isNew);
            }           
        }
        catch(Exception e)
        {
            throw new UserException("Failed instantiate an User implementation object: " + e.toString());
        }

        return user;
    }
View Full Code Here

        {
            criteria.add(TurbineUserPeer.USER_ID, principal.getName());
        }
        else
        {
            throw new UserException("Invalid Principal Type in getUser: " + principal.getClass().getName());
        }
        List users;
        try
        {
            users = TurbineUserPeer.doSelectUsers(criteria);
        }
        catch(Exception e)
        {
            String message = "Failed to retrieve user '" + principal.getName() + "'";
            logger.error( message, e );
            throw new UserException( message, e );
        }
        if ( users.size() > 1 )
        {
            throw new UserException(
                "Multiple Users with same username '" + principal.getName() + "'");
        }
        if ( users.size() == 1 )
        {
            return (JetspeedUser)users.get(0);
View Full Code Here

            users = TurbineUserPeer.doSelectUsers(criteria);
        }
        catch(Exception e)
        {
            logger.error( "Failed to retrieve users ", e );
            throw new UserException("Failed to retrieve users ", e);
        }
        return users.iterator();
    }
View Full Code Here

            users = TurbineUserPeer.doSelectUsers(criteria);
        }
        catch(Exception e)
        {
            logger.error( "Failed to retrieve users ", e );
            throw new UserException("Failed to retrieve users ", e);
        }
        return users.iterator();
    }
View Full Code Here

            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

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.