Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# Copyright 2012 Nebula, Inc. # # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License.
# gap, in seconds, to determine whether the given token is about to expire
"""An object for encapsulating a raw authentication token from keystone and helper methods for extracting useful values from that token."""
""" Determines if expiration is about to occur.
:return: boolean : true if expiration is within the given duration
""" else stale_duration) # (gyee) should we move auth_token.will_expire_soon() to timeutils # instead of duplicating code here? seconds=stale_duration))
def expires(self): """ Returns the token expiration (as datetime object)
:returns: datetime
"""
def auth_token(self): """ Returns the token_id associated with the auth request, to be used in headers for authenticating OpenStack API requests.
:returns: str """
def username(self): """ Returns the username associated with the authentication request. Follows the pattern defined in the V2 API of first looking for 'name', returning that if available, and falling back to 'username' if name is unavailable.
:returns: str """ else: return self['user'].get('username', None)
def user_id(self): """ Returns the user id associated with the authentication request.
:returns: str """
def tenant_name(self): """ Returns the tenant (project) name associated with the authentication request.
:returns: str """
def project_name(self): """ Synonym for tenant_name """
def scoped(self): """ Returns true if the authorization token was scoped to a tenant (project), and contains a populated service catalog.
:returns: bool """ and self['serviceCatalog'] and 'tenant' in self['token']):
def tenant_id(self): """ Returns the tenant (project) id associated with the authentication request, or None if the authentication request wasn't scoped to a tenant (project).
:returns: str """
def project_id(self): """ Synonym for project_id """
if x['type'] == 'identity'] for svc in identity_services for endpoint in svc['endpoints'] if endpoint_type in endpoint)
def auth_url(self): """ Returns a tuple of URLs from publicURL and adminURL for the service 'identity' from the service catalog associated with the authorization request. If the authentication request wasn't scoped to a tenant (project), this property will return None.
:returns: tuple of urls """
def management_url(self): """ Returns the first adminURL for 'identity' from the service catalog associated with the authorization request, or None if the authentication request wasn't scoped to a tenant (project).
:returns: tuple of urls """ |