diff options
| author | Jamie Lennox <jamielennox@redhat.com> | 2014-09-03 12:51:26 +1000 |
|---|---|---|
| committer | Jamie Lennox <jamielennox@redhat.com> | 2015-01-05 09:56:40 +1000 |
| commit | 4cc1631665ac3f6d778b2d7ff538f1156ae793e4 (patch) | |
| tree | 21f48aacb80b10888617e7f7e86b6457dad0f60f /keystoneclient/auth/base.py | |
| parent | 53a82232ff52b9f39a3cb22d1769c3f9134e7003 (diff) | |
| download | python-keystoneclient-4cc1631665ac3f6d778b2d7ff538f1156ae793e4.tar.gz | |
Allow fetching user_id/project_id from auth
This would ideally not be required however when building certain URLs
the current user_id is needed. And when communicating with certain
services we need to have access to the current project id. It seems
better to allow plugins to give up the information if they have it than
do various hacks to try and get it from them.
Change-Id: Ib61b0628702806268be623a9987a922a60b04165
Closes-Bug: #1364724
Diffstat (limited to 'keystoneclient/auth/base.py')
| -rw-r--r-- | keystoneclient/auth/base.py | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/keystoneclient/auth/base.py b/keystoneclient/auth/base.py index 4c743d9..ecbcf96 100644 --- a/keystoneclient/auth/base.py +++ b/keystoneclient/auth/base.py @@ -108,6 +108,36 @@ class BaseAuthPlugin(object): """ return False + def get_user_id(self, session, **kwargs): + """Return a unique user identifier of the plugin. + + Wherever possible the user id should be inferred from the token however + there are certain URLs and other places that require access to the + currently authenticated user id. + + :param session: A session object so the plugin can make HTTP calls. + :type session: keystoneclient.session.Session + + :returns: A user identifier or None if one is not available. + :rtype: str + """ + return None + + def get_project_id(self, session, **kwargs): + """Return the project id that we are authenticated to. + + Wherever possible the project id should be inferred from the token + however there are certain URLs and other places that require access to + the currently authenticated project id. + + :param session: A session object so the plugin can make HTTP calls. + :type session: keystoneclient.session.Session + + :returns: A project identifier or None if one is not available. + :rtype: str + """ + return None + @classmethod def get_options(cls): """Return the list of parameters associated with the auth plugin. |
