diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-06-14 16:59:11 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-06-14 16:59:11 +0000 |
| commit | deeefdb7c27d0f1940682be1215d5f7c58de30a9 (patch) | |
| tree | d9da9de8635083a72b9f656d7d9dc22aba2ca1ce | |
| parent | 84a7f3751088159035d89920fa8590aa206d65e5 (diff) | |
| parent | 3ed1cafebd8abe28b0846544843f67f84ed3b757 (diff) | |
Merge "Tweak for easier, safer subclassing"
| -rw-r--r-- | keystone/identity/backends/sql.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/keystone/identity/backends/sql.py b/keystone/identity/backends/sql.py index 46518f8a..78325816 100644 --- a/keystone/identity/backends/sql.py +++ b/keystone/identity/backends/sql.py @@ -135,6 +135,20 @@ class Identity(sql.Base, identity.Driver): def db_sync(self): migration.db_sync() + def _check_password(self, password, user_ref): + """Check the specified password against the data store. + + This is modeled on ldap/core.py. The idea is to make it easier to + subclass Identity so that you can still use it to store all the data, + but use some other means to check the password. + Note that we'll pass in the entire user_ref in case the subclass + needs things like user_ref.get('name') + For further justification, please see the follow up suggestion at + https://blueprints.launchpad.net/keystone/+spec/sql-identiy-pam + + """ + return utils.check_password(password, user_ref.get('password')) + # Identity interface def authenticate(self, user_id=None, tenant_id=None, password=None): """Authenticate based on a user, tenant and password. @@ -145,7 +159,7 @@ class Identity(sql.Base, identity.Driver): """ user_ref = self._get_user(user_id) if (not user_ref - or not utils.check_password(password, user_ref.get('password'))): + or not self._check_password(password, user_ref)): raise AssertionError('Invalid user / password') tenants = self.get_tenants_for_user(user_id) |
