'Use remote_user to look up the user in the identity backend.
The domain will be extracted from the REMOTE_DOMAIN environment
variable if present. If not, the default domain will be used.'

def _authenticate(self, request):

    if request.remote_domain:
        ref = self.resource_api.get_domain_by_name(request.remote_domain)
        domain_id = ref['id']
    else:
        domain_id = CONF.identity.default_domain_id
    return self.identity_api.get_user_by_name(request.remote_user, domain_id)
