Package org.apache.james.user.api.model

Examples of org.apache.james.user.api.model.User


        throw new UnsupportedOperationException("mock");
    }

    @Override
    public boolean test(String name, String password) throws UsersRepositoryException {
        User user = getUserByName(name);
        return user != null && user.verifyPassword(password);
    }
View Full Code Here


    protected List<String> listUserNames() {
        Iterator<User> users = m_users.values().iterator();
        List<String> userNames = new LinkedList<String>();
        while (users.hasNext()) {
            User user = users.next();
            userNames.add(user.getUserName());
        }

        return userNames;
    }
View Full Code Here

    /**
     * @see
     * org.apache.james.user.lib.AbstractUsersRepository#doAddUser(java.lang.String, java.lang.String)
     */
    protected void doAddUser(String username, String password) throws UsersRepositoryException {
        User newbie = new DefaultJamesUser(username, "SHA");
        newbie.setPassword(password);
        doAddUser(newbie);
    }
View Full Code Here

     *      java.lang.String)
     */
    public Collection<String> getMappings(String username, String domain) throws ErrorMappingException, RecipientRewriteTableException {
        Collection<String> mappings = new ArrayList<String>();
        try {
            User user = getUserByName(username);

            if (user instanceof JamesUser) {
                JamesUser jUser = (JamesUser) user;

                if (enableAliases && jUser.getAliasing()) {
View Full Code Here

    public UsersRepositoryManagement() throws NotCompliantMBeanException {
        super(UsersRepositoryManagementMBean.class);
    }

    private JamesUser getJamesUser(String userName) throws UsersRepositoryException {
        User baseuser = usersRepository.getUserByName(userName);
        if (baseuser == null)
            throw new IllegalArgumentException("user not found: " + userName);
        if (!(baseuser instanceof JamesUser))
            throw new IllegalArgumentException("user is not of type JamesUser: " + userName);
View Full Code Here

    }

    @Override
    public void setPassword(String userName, String password) throws Exception {
        try {
            User user = usersRepository.getUserByName(userName);
            if (user == null)
                throw new UsersRepositoryException("user not found: " + userName);
            if (!user.setPassword(password)) {
                throw new UsersRepositoryException("Unable to update password for user " + user);
            }
            usersRepository.updateUser(user);
        } catch (UsersRepositoryException e) {
            throw new Exception(e.getMessage());
View Full Code Here

     * @param userName
     *            the user to be removed
     * @throws UsersRepositoryException
     */
    public void removeUser(String userName) throws UsersRepositoryException {
        User user = getUserByName(userName);
        if (user != null) {
            doRemoveUser(user);
        } else {
            throw new UsersRepositoryException("User " + userName + " does not exist");
        }
View Full Code Here

     * Returns whether or not this user is in the repository
     *
     * @return true or false
     */
    public boolean contains(String name) throws UsersRepositoryException {
        User user = getUserByName(name, ignoreCase);
        return (user != null);
    }
View Full Code Here

     * on a case insensitive basis.
     *
     * @return true or false
     */
    public boolean containsCaseInsensitive(String name) throws UsersRepositoryException {
        User user = getUserByName(name, true);
        return (user != null);
    }
View Full Code Here

     * @return true if the test is successful, false if the password is
     *         incorrect or the user doesn't exist
     * @since James 1.2.2
     */
    public boolean test(String name, String password) throws UsersRepositoryException {
        User user = getUserByName(name, ignoreCase);
        return user != null && user.verifyPassword(password);
    }
View Full Code Here

TOP

Related Classes of org.apache.james.user.api.model.User

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.