summaryrefslogtreecommitdiffstats
path: root/keystone/auth/plugins/password.py
diff options
context:
space:
mode:
Diffstat (limited to 'keystone/auth/plugins/password.py')
-rw-r--r--keystone/auth/plugins/password.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/keystone/auth/plugins/password.py b/keystone/auth/plugins/password.py
index 631ce08d..f3cfeba8 100644
--- a/keystone/auth/plugins/password.py
+++ b/keystone/auth/plugins/password.py
@@ -103,8 +103,14 @@ class Password(auth.AuthMethodHandler):
# FIXME(gyee): identity.authenticate() can use some refactoring since
# all we care is password matches
- self.identity_api.authenticate(
- user_id=user_info.user_id,
- password=user_info.password)
+ try:
+ self.identity_api.authenticate(
+ user_id=user_info.user_id,
+ password=user_info.password)
+ except AssertionError:
+ # authentication failed because of invalid username or password
+ msg = _('Invalid username or password')
+ raise exception.Unauthorized(msg)
+
if 'user_id' not in user_context:
user_context['user_id'] = user_info.user_id