public static AuthToken authenticate(String username, String password)
            throws UnauthorizedException, ConnectionException, InternalUnauthenticatedException {
        if (LockOutManager.getInstance().isAccountDisabled(username)) {
            LockOutManager.getInstance().recordFailedLogin(username);
            throw new UnauthorizedException();
        }
        authProvider.authenticate(username, password);
        return AuthToken.generateUserToken( username );
    }
Authenticates a user with a username and plain text password and returns and
AuthToken. If the username and password do not match the record of
any user in the system, this method throws an UnauthorizedException.

@param username the username.
@param password the password.
@return an AuthToken token if the username and password are correct.
@throws UnauthorizedException if the username and password do not match any existing user
     or the account is locked out.
@throws ConnectionException if there is a problem connecting to user and group system
@throws InternalUnauthenticatedException if there is a problem authentication Openfire itself into the user and group system
xmppserver/src/main/java/org/jivesoftware/openfire/auth/AuthFactory.java