raise and catch correct authenticate error
This commit is contained in:
parent
c59370eda0
commit
3cce41e280
|
@ -149,11 +149,14 @@ class TokenController(wsgi.Application):
|
||||||
else:
|
else:
|
||||||
tenant_id = auth.get('tenantId', None)
|
tenant_id = auth.get('tenantId', None)
|
||||||
|
|
||||||
(user_ref, tenant_ref, metadata_ref) = \
|
try:
|
||||||
self.identity_api.authenticate(context=context,
|
(user_ref, tenant_ref, metadata_ref) = \
|
||||||
user_id=user_id,
|
self.identity_api.authenticate(context=context,
|
||||||
password=password,
|
user_id=user_id,
|
||||||
tenant_id=tenant_id)
|
password=password,
|
||||||
|
tenant_id=tenant_id)
|
||||||
|
except AssertionError as e:
|
||||||
|
raise webob.exc.HTTPForbidden(e.message)
|
||||||
token_ref = self.token_api.create_token(
|
token_ref = self.token_api.create_token(
|
||||||
context, token_id, dict(expires='',
|
context, token_id, dict(expires='',
|
||||||
id=token_id,
|
id=token_id,
|
||||||
|
|
|
@ -212,8 +212,7 @@ class KcMasterTestCase(CompatTestCase):
|
||||||
user = client.users.get(user.id)
|
user = client.users.get(user.id)
|
||||||
self.assertFalse(user.enabled)
|
self.assertFalse(user.enabled)
|
||||||
|
|
||||||
# TODO(ja): test that you can't login
|
self.assertRaises(client_exceptions.AuthorizationFailure,
|
||||||
self.assertRaises(client_exceptions.Forbidden,
|
|
||||||
self._client,
|
self._client,
|
||||||
username=test_username,
|
username=test_username,
|
||||||
password='password')
|
password='password')
|
||||||
|
|
Loading…
Reference in New Issue