keystoneauth1.access package

Submodules

keystoneauth1.access.access module

class keystoneauth1.access.access.AccessInfo(body, auth_token=None)

Bases: object

Encapsulates a raw authentication token from keystone.

Provides helper methods for extracting useful values from that token.

audit_chain_id None

Return the audit chain ID if present.

In the event that a token was rescoped then this ID will be the audit_id of the initial token. Returns None if no value present.

Returns:str or None.
audit_id None

Return the audit ID if present.

Returns:str or None.
auth_token None

Return the token_id associated with the auth request.

To be used in headers for authenticating OpenStack API requests.

Returns:str
bind None

Information about external mechanisms the token is bound to.

If a token is bound to an external authentication mechanism it can only be used in conjunction with that mechanism. For example if bound to a kerberos principal it may only be accepted if there is also kerberos authentication performed on the request.

Returns:A dictionary or None. The key will be the bind type the value is a dictionary that is specific to the format of the bind type. Returns None if there is no bind information in the token.
domain_id None

Return the domain id associated with the auth request.

Returns:str or None (if no domain associated with the token)
domain_name None

Return the domain name associated with the auth request.

Returns:str or None (if no domain associated with the token)
domain_scoped None

Return true if the auth token was scoped to a domain.

Returns:bool
expires None

Return the token expiration (as datetime object).

Returns:datetime
has_service_catalog()

Return true if the auth token has a service catalog.

Returns:boolean
initial_audit_id None

The audit ID of the initially requested token.

This is the audit_chain_id if present or the audit_id.

is_admin_project None

Return true if the current project scope is the admin project.

For backwards compatibility purposes if there is nothing specified in the token we always assume we are in the admin project, so this will default to True.

:returns boolean

is_federated None

Return true if federation was used to get the token.

Returns:boolean
issued None

Return the token issue time (as datetime object).

Returns:datetime
oauth_access_token_id None

Return the access token ID if OAuth authentication used.

Returns:str or None.
oauth_consumer_id None

Return the consumer ID if OAuth authentication used.

Returns:str or None.
project_domain_id None

Return the project’s domain id associated with the auth request.

Returns:str
project_domain_name None

Return the project’s domain name associated with the auth request.

Returns:str
project_id None

Return the project ID associated with the auth request.

This returns None if the auth token wasn’t scoped to a project.

Returns:str or None (if no project associated with the token)
project_is_domain None

Return if a project act as a domain.

Returns:bool
project_name None

Return the project name associated with the auth request.

Returns:str or None (if no project associated with the token)
project_scoped None

Return true if the auth token was scoped to a tenant (project).

Returns:bool
role_ids None

Return a list of user’s role ids associated with the auth request.

Returns:a list of strings of role ids
role_names None

Return a list of user’s role names associated with the auth request.

Returns:a list of strings of role names
scoped None

Return true if the auth token was scoped.

Returns true if scoped to a tenant(project) or domain, and contains a populated service catalog.

This is deprecated, use project_scoped instead.

Returns:bool
service_catalog None
service_providers None

Return an object representing the list of trusted service providers.

Used for Keystone2Keystone federating-out.

Returns:keystoneauth1.service_providers.ServiceProviders or None
tenant_id None

Synonym for project_id.

tenant_name None

Synonym for project_name.

trust_id None

Return the trust id associated with the auth request.

Returns:str or None (if no trust associated with the token)
trust_scoped None

Return true if the auth token was scoped from a delegated trust.

The trust delegation is via the OS-TRUST v3 extension.

Returns:bool
trustee_user_id None

Return the trustee user id associated with a trust.

Returns:str or None (if no trust associated with the token)
trustor_user_id None

Return the trustor user id associated with a trust.

Returns:str or None (if no trust associated with the token)
user_domain_id None

Return the user’s domain id associated with the auth request.

Returns:str
user_domain_name None

Return the user’s domain name associated with the auth request.

Returns:str
user_id None

Return the user id associated with the auth request.

Returns:str
username None

Return the username associated with the auth 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
will_expire_soon(stale_duration=30)

Determine if expiration is about to occur.

Returns:true if expiration is within the given duration
Return type:boolean
class keystoneauth1.access.access.AccessInfoV2(body, auth_token=None)

Bases: keystoneauth1.access.access.AccessInfo

An object for encapsulating raw v2 auth token from identity service.

audit_chain_id None
audit_id None
auth_token None
bind None
domain_id None
domain_name None
domain_scoped None
expires None
has_service_catalog()
is_admin_project None
is_federated None
issued None
oauth_access_token_id None
oauth_consumer_id None
project_domain_id None
project_domain_name None
project_id None
project_is_domain None
project_name None
role_ids None
role_names None
service_providers None
trust_id None
trust_scoped None
trustee_user_id None
trustor_user_id None
user_domain_id None
user_domain_name None
user_id None
username None
version = 'v2.0'
class keystoneauth1.access.access.AccessInfoV3(body, auth_token=None)

Bases: keystoneauth1.access.access.AccessInfo

An object encapsulating raw v3 auth token from identity service.

audit_chain_id None
audit_id None
bind None
domain_id None
domain_name None
domain_scoped None
expires None
has_service_catalog()
is_admin_project None
is_federated None
issued None
oauth_access_token_id None
oauth_consumer_id None
project_domain_id None
project_domain_name None
project_id None
project_is_domain None
project_name None
role_ids None
role_names None
service_providers None
trust_id None
trust_scoped None
trustee_user_id None
trustor_user_id None
user_domain_id None
user_domain_name None
user_id None
username None
version = 'v3'
keystoneauth1.access.access.create(resp=None, body=None, auth_token=None)

keystoneauth1.access.service_catalog module

class keystoneauth1.access.service_catalog.ServiceCatalog(catalog)

Bases: object

Helper methods for dealing with a Keystone Service Catalog.

catalog None

Return the raw service catalog content, mostly useful for debugging.

Applications should avoid this and use accessor methods instead. However, there are times when inspecting the raw catalog can be useful for analysis and other reasons.

get_endpoints(service_type=None, interface=None, region_name=None, service_name=None, service_id=None, endpoint_id=None)

Fetch and filter endpoints for the specified service(s).

Returns endpoints for the specified service (or all) containing the specified type (or all) and region (or all) and service name.

If there is no name in the service catalog the service_name check will be skipped. This allows compatibility with services that existed before the name was available in the catalog.

get_urls(service_type=None, interface='public', region_name=None, service_name=None, service_id=None, endpoint_id=None)

Fetch endpoint urls from the service catalog.

Fetch the endpoints from the service catalog for a particular endpoint attribute. If no attribute is given, return the first endpoint of the specified type.

Parameters:
  • service_type (string) – Service type of the endpoint.
  • interface (string) – Type of endpoint. Possible values: public or publicURL, internal or internalURL, admin or adminURL
  • region_name (string) – Region of the endpoint.
  • service_name (string) – The assigned name of the service.
  • service_id (string) – The identifier of a service.
  • endpoint_id (string) – The identifier of an endpoint.
Returns:

tuple of urls or None (if no match found)

is_interface_match(endpoint, interface)

Helper function to normalize endpoint matching across v2 and v3.

Returns:True if the provided endpoint matches the required interface otherwise False.
static normalize_interface(interface)

Handle differences in the way v2 and v3 catalogs specify endpoint.

Both v2 and v3 must be able to handle the endpoint style of the other. For example v2 must be able to handle a ‘public’ interface and v3 must be able to handle a ‘publicURL’ interface.

Returns:the endpoint string in the format appropriate for this service catalog.
url_for(service_type=None, interface='public', region_name=None, service_name=None, service_id=None, endpoint_id=None)

Fetch an endpoint from the service catalog.

Fetch the specified endpoint from the service catalog for a particular endpoint attribute. If no attribute is given, return the first endpoint of the specified type.

Valid interface types: public or publicURL,
internal or internalURL, admin or ‘adminURL`
Parameters:
  • service_type (string) – Service type of the endpoint.
  • interface (string) – Type of endpoint.
  • region_name (string) – Region of the endpoint.
  • service_name (string) – The assigned name of the service.
  • service_id (string) – The identifier of a service.
  • endpoint_id (string) – The identifier of an endpoint.
class keystoneauth1.access.service_catalog.ServiceCatalogV2(catalog)

Bases: keystoneauth1.access.service_catalog.ServiceCatalog

An object for encapsulating the v2 service catalog.

The object is created using raw v2 auth token from Keystone.

classmethod from_token(token)
get_urls(service_type=None, interface='publicURL', region_name=None, service_name=None, service_id=None, endpoint_id=None)
is_interface_match(endpoint, interface)
static normalize_interface(interface)
class keystoneauth1.access.service_catalog.ServiceCatalogV3(catalog)

Bases: keystoneauth1.access.service_catalog.ServiceCatalog

An object for encapsulating the v3 service catalog.

The object is created using raw v3 auth token from Keystone.

classmethod from_token(token)
get_urls(service_type=None, interface='publicURL', region_name=None, service_name=None, service_id=None, endpoint_id=None)
is_interface_match(endpoint, interface)
static normalize_interface(interface)

keystoneauth1.access.service_providers module

class keystoneauth1.access.service_providers.ServiceProviders(service_providers)

Bases: object

Helper methods for dealing with Service Providers.

classmethod from_token(token)
get_auth_url(sp_id)
get_sp_url(sp_id)

Module contents

class keystoneauth1.access.AccessInfo(body, auth_token=None)

Bases: object

Encapsulates a raw authentication token from keystone.

Provides helper methods for extracting useful values from that token.

audit_chain_id None

Return the audit chain ID if present.

In the event that a token was rescoped then this ID will be the audit_id of the initial token. Returns None if no value present.

Returns:str or None.
audit_id None

Return the audit ID if present.

Returns:str or None.
auth_token None

Return the token_id associated with the auth request.

To be used in headers for authenticating OpenStack API requests.

Returns:str
bind None

Information about external mechanisms the token is bound to.

If a token is bound to an external authentication mechanism it can only be used in conjunction with that mechanism. For example if bound to a kerberos principal it may only be accepted if there is also kerberos authentication performed on the request.

Returns:A dictionary or None. The key will be the bind type the value is a dictionary that is specific to the format of the bind type. Returns None if there is no bind information in the token.
domain_id None

Return the domain id associated with the auth request.

Returns:str or None (if no domain associated with the token)
domain_name None

Return the domain name associated with the auth request.

Returns:str or None (if no domain associated with the token)
domain_scoped None

Return true if the auth token was scoped to a domain.

Returns:bool
expires None

Return the token expiration (as datetime object).

Returns:datetime
has_service_catalog()

Return true if the auth token has a service catalog.

Returns:boolean
initial_audit_id None

The audit ID of the initially requested token.

This is the audit_chain_id if present or the audit_id.

is_admin_project None

Return true if the current project scope is the admin project.

For backwards compatibility purposes if there is nothing specified in the token we always assume we are in the admin project, so this will default to True.

:returns boolean

is_federated None

Return true if federation was used to get the token.

Returns:boolean
issued None

Return the token issue time (as datetime object).

Returns:datetime
oauth_access_token_id None

Return the access token ID if OAuth authentication used.

Returns:str or None.
oauth_consumer_id None

Return the consumer ID if OAuth authentication used.

Returns:str or None.
project_domain_id None

Return the project’s domain id associated with the auth request.

Returns:str
project_domain_name None

Return the project’s domain name associated with the auth request.

Returns:str
project_id None

Return the project ID associated with the auth request.

This returns None if the auth token wasn’t scoped to a project.

Returns:str or None (if no project associated with the token)
project_is_domain None

Return if a project act as a domain.

Returns:bool
project_name None

Return the project name associated with the auth request.

Returns:str or None (if no project associated with the token)
project_scoped None

Return true if the auth token was scoped to a tenant (project).

Returns:bool
role_ids None

Return a list of user’s role ids associated with the auth request.

Returns:a list of strings of role ids
role_names None

Return a list of user’s role names associated with the auth request.

Returns:a list of strings of role names
scoped None

Return true if the auth token was scoped.

Returns true if scoped to a tenant(project) or domain, and contains a populated service catalog.

This is deprecated, use project_scoped instead.

Returns:bool
service_catalog None
service_providers None

Return an object representing the list of trusted service providers.

Used for Keystone2Keystone federating-out.

Returns:keystoneauth1.service_providers.ServiceProviders or None
tenant_id None

Synonym for project_id.

tenant_name None

Synonym for project_name.

trust_id None

Return the trust id associated with the auth request.

Returns:str or None (if no trust associated with the token)
trust_scoped None

Return true if the auth token was scoped from a delegated trust.

The trust delegation is via the OS-TRUST v3 extension.

Returns:bool
trustee_user_id None

Return the trustee user id associated with a trust.

Returns:str or None (if no trust associated with the token)
trustor_user_id None

Return the trustor user id associated with a trust.

Returns:str or None (if no trust associated with the token)
user_domain_id None

Return the user’s domain id associated with the auth request.

Returns:str
user_domain_name None

Return the user’s domain name associated with the auth request.

Returns:str
user_id None

Return the user id associated with the auth request.

Returns:str
username None

Return the username associated with the auth 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
will_expire_soon(stale_duration=30)

Determine if expiration is about to occur.

Returns:true if expiration is within the given duration
Return type:boolean
class keystoneauth1.access.AccessInfoV2(body, auth_token=None)

Bases: keystoneauth1.access.access.AccessInfo

An object for encapsulating raw v2 auth token from identity service.

audit_chain_id None
audit_id None
auth_token None
bind None
domain_id None
domain_name None
domain_scoped None
expires None
has_service_catalog()
is_admin_project None
is_federated None
issued None
oauth_access_token_id None
oauth_consumer_id None
project_domain_id None
project_domain_name None
project_id None
project_is_domain None
project_name None
role_ids None
role_names None
service_providers None
trust_id None
trust_scoped None
trustee_user_id None
trustor_user_id None
user_domain_id None
user_domain_name None
user_id None
username None
version = 'v2.0'
class keystoneauth1.access.AccessInfoV3(body, auth_token=None)

Bases: keystoneauth1.access.access.AccessInfo

An object encapsulating raw v3 auth token from identity service.

audit_chain_id None
audit_id None
bind None
domain_id None
domain_name None
domain_scoped None
expires None
has_service_catalog()
is_admin_project None
is_federated None
issued None
oauth_access_token_id None
oauth_consumer_id None
project_domain_id None
project_domain_name None
project_id None
project_is_domain None
project_name None
role_ids None
role_names None
service_providers None
trust_id None
trust_scoped None
trustee_user_id None
trustor_user_id None
user_domain_id None
user_domain_name None
user_id None
username None
version = 'v3'
keystoneauth1.access.create(resp=None, body=None, auth_token=None)