'Authenticate credentials and return a token.
Accept auth as a dict that looks like::
"auth":{
"passwordCredentials":{
"username":"test_user",
"password":"mypass"
"tenantName":"customer-x"
In this case, tenant is optional, if not provided the token will be
considered "unscoped" and can later be used to get a scoped token.
Alternatively, this call accepts auth with only a token and tenant
that will return a token that is scoped to that tenant.'

@controller.v2_auth_deprecated
def authenticate(self, request, auth=None):

    method = authentication_method_generator(request, auth)
    (user_ref, project_id, expiry, bind, audit_id) = method.authenticate(request, auth)
    try:
        self.identity_api.assert_user_enabled(user_id=user_ref['id'], user=user_ref)
        if project_id:
            try:
                self.resource_api.get_project(project_id)
            except exception.ProjectNotFound:
                msg = (_('Project    ID    not    found:    %(p_id)s') % {'p_id': project_id})
                raise exception.Unauthorized(msg)
            self.resource_api.assert_project_enabled(project_id)
    except AssertionError as e:
        six.reraise(exception.Unauthorized, exception.Unauthorized(e), sys.exc_info()[2])
    user_ref = self.v3_to_v2_user(user_ref)
    auth_context = {}
    if bind:
        auth_context['bind'] = bind
    trust_ref = None
    if (CONF.trust.enabled and ('trust_id' in auth)):
        trust_ref = self.trust_api.get_trust(auth['trust_id'])
    (token_id, token_data) = self.token_provider_api.issue_token(user_ref['id'], ['password'], expires_at=expiry, project_id=project_id, trust=trust_ref, parent_audit_id=audit_id, auth_context=auth_context)
    v2_helper = V2TokenDataHelper()
    token_data = v2_helper.v3_to_v2_token(token_data, token_id)
    if (CONF.trust.enabled and ('trust_id' in auth)):
        self.trust_api.consume_use(auth['trust_id'])
    return token_data
