/usr/lib/python2.6/site-packages/keystoneauth1/identity
Edit: /usr/lib/python2.6/site-packages/keystoneauth1/identity/base.pyc (10614B)
Ñò
DVc @ s¢ d d k Z d d k Z d d k Z d d k l Z d d k l Z d d k l Z d d k l Z e i e
ƒ Z e i e i
ƒ d e i f d „ ƒ Yƒ Z d S( iÿÿÿÿN( t _utils( t discover( t
exceptions( t plugint BaseIdentityPluginc B s§ e Z d Z d
e d „ Z e i d „ ƒ Z d „ Z d „ Z
d „ Z d „ Z d
d
d
d
d
d „ Z
d „ Z d „ Z d
„ Z d „ Z e i ƒ d
d „ ƒ Z RS( ix c C sJ t t | ƒ i ƒ | | _ d | _ | | _ h | _ t i ƒ | _
d S( N( t superR t __init__t auth_urlt Nonet auth_reft reauthenticatet _endpoint_cachet threadingt Lockt _lock( t selfR R
( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyR ! s c K s d S( sj Obtain a token from an OpenStack Identity Service.
This method is overridden by the various token version plugins.
This function should not be called independently and is expected to be
invoked via the do_authenticate function.
This function will be invoked if the AcessInfo object cached by the
plugin is not valid. Thus plugins should always fetch a new AccessInfo
when invoked. If you are looking to just retrieve the current auth
data then you should use get_access.
:param session: A session object that can be used for communication.
:type session: keystonauth.session.Session
:raises keystonauth.exceptions.InvalidResponse: The response
returned wasn't
appropriate.
:raises keystonauth.exceptions.HttpError: An error from an invalid
HTTP response.
:returns: Token access information.
:rtype: :py:class:`keystonauth.access.AccessInfo`
N( ( R t sessiont kwargs( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyt get_auth_ref, s c K s | i | ƒ i S( sµ Return a valid auth token.
If a valid token is not present then a new one will be fetched.
:param session: A session object that can be used for communication.
:type session: keystonauth.session.Session
:raises keystonauth.exceptions.HttpError: An error from an invalid
HTTP response.
:return: A valid token.
:rtype: string
( t
get_accesst
auth_token( R R R ( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyt get_tokenG s c C s= | i p t S| i p t S| i i | i ƒ o t St S( sÕ Return if the existing token needs to be re-authenticated.
The token should be refreshed if it is about to expire.
:returns: True if the plugin should fetch a new token. False otherwise.
( R t TrueR
t Falset will_expire_soont MIN_TOKEN_LIFE_SECONDS( R ( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyt _needs_reauthenticateW s
c K sE | i i i ƒ z' | i ƒ o | i | ƒ | _ n Wd QX| i S( s Fetch or return a current AccessInfo object.
If a valid AccessInfo is present then it is returned otherwise a new
one will be fetched.
:param session: A session object that can be used for communication.
:type session: keystonauth.session.Session
:raises keystonauth.exceptions.HttpError: An error from an invalid
HTTP response.
:returns: Valid AccessInfo
:rtype: :py:class:`keystonauth.access.AccessInfo`
N( R t __exit__t __enter__R R R ( R R R ( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyR m s
c C s | i o d | _ t St S( s Invalidate the current authentication data.
This should result in fetching a new token on next call.
A plugin may be invalidated if an Unauthorized HTTP response is
returned to indicate that the token may have been revoked or is
otherwise now invalid.
:returns: True if there was something that the plugin did to
invalidate. This means that it makes sense to try again. If
nothing happens returns False to indicate give up.
:rtype: bool
N( R R R R ( R ( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyt
invalidate‡ s
c K s | t i j o | i } | p d } na | p t i d ƒ d
S| p
d } n | i | ƒ i } | i d | d | d | d | ƒ } | p | St i
| | ƒ }
y | i | |
d t ƒ} Wn5 t
i t
i t
i f j
o t i d | ƒ n X| i | ƒ } | S( sÔ Return a valid endpoint for a service.
If a valid token is not present then a new one will be fetched using
the session and kwargs.
:param session: A session object that can be used for communication.
:type session: keystonauth.session.Session
:param string service_type: The type of service to lookup the endpoint
for. This plugin will return None (failure)
if service_type is not provided.
:param string interface: The exposure of the endpoint. Should be
`public`, `internal`, `admin`, or `auth`.
`auth` is special here to use the `auth_url`
rather than a URL extracted from the service
catalog. Defaults to `public`.
:param string region_name: The region the endpoint should exist in.
(optional)
:param string service_name: The name of the service in the catalog.
(optional)
:param tuple version: The minimum version number required for this
endpoint. (optional)
:raises keystonauth.exceptions.HttpError: An error from an invalid
HTTP response.
:return: A valid endpoint URL or None if not available.
:rtype: string or None
t identitys€ Plugin cannot return an endpoint without knowing the service type that is required. Add service_type to endpoint filtering data.t publict service_typet interfacet region_namet service_namet
authenticatedsd Failed to contact the endpoint at %s for discovery. Fallback to using that endpoint as the base url.N( R t AUTH_INTERFACER t LOGt warnR R t service_catalogt url_forR t _get_catalog_discover_hackt
get_discoveryR R t DiscoveryFailuret HttpErrort ConnectionErrort warning( R R R R! R" R# t versionR t urlR( t
hacked_urlt disc( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyt get_endpoint› s2 $
c K s | i | ƒ i S( N( R t user_id( R R R ( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyt get_user_idð s c K s | i | ƒ i S( N( R t
project_id( R R R ( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyt get_project_idó s c K s; y | i | ƒ i i | ƒ SWn t i j
o d SXd S( N( R t service_providerst get_auth_urlR t ServiceProviderNotFoundR ( R R t sp_idR ( ( sB /tmp/pip-build-lt8jXN/keystoneauth1/keystoneauth1/identity/base.pyt get_sp_auth_urlö s
c K s; y | i | ƒ i i | ƒ SWn t i j
o d SXd S( N( R R9 t
get_sp_urlR R; R ( R R R<