'Try to authenticate against the identity backend.
:param request: A request object.
:param auth: Dictionary representing the authentication request.
:returns: A tuple containing the user reference, project identifier,
token expiration, bind information, and original audit
information.'

def authenticate(self, request, auth):

    if ('password' not in auth['passwordCredentials']):
        raise exception.ValidationError(attribute='password', target='passwordCredentials')
    password = auth['passwordCredentials']['password']
    if (password and (len(password) > CONF.identity.max_password_length)):
        raise exception.ValidationSizeError(attribute='password', size=CONF.identity.max_password_length)
    if ((not auth['passwordCredentials'].get('userId')) and (not auth['passwordCredentials'].get('username'))):
        raise exception.ValidationError(attribute='username    or    userId', target='passwordCredentials')
    user_id = auth['passwordCredentials'].get('userId')
    if (user_id and (len(user_id) > CONF.max_param_size)):
        raise exception.ValidationSizeError(attribute='userId', size=CONF.max_param_size)
    username = auth['passwordCredentials'].get('username', '')
    if username:
        if (len(username) > CONF.max_param_size):
            raise exception.ValidationSizeError(attribute='username', size=CONF.max_param_size)
        try:
            user_ref = self.identity_api.get_user_by_name(username, CONF.identity.default_domain_id)
            user_id = user_ref['id']
        except exception.UserNotFound as e:
            raise exception.Unauthorized(e)
    try:
        user_ref = self.identity_api.authenticate(request, user_id=user_id, password=password)
    except AssertionError as e:
        raise exception.Unauthorized(e.args[0])
    project_id = self._get_project_id_from_auth(auth)
    expiry = common.default_expire_time()
    bind = None
    audit_id = None
    return (user_ref, project_id, expiry, bind, audit_id)
