keystoneauth1.identity.v3.oauth2_client_credential module

exception keystoneauth1.identity.v3.oauth2_client_credential.ClientException(message: str | None = None)

Bases: Exception

The base exception for everything to do with clients.

__annotations_cache__ = {}
__doc__ = 'The base exception for everything to do with clients.'
__firstlineno__ = 17
__init__(message: str | None = None)
__module__ = 'keystoneauth1.exceptions.base'
__static_attributes__ = ('message',)
__weakref__

list of weak references to the object

message = 'ClientException'
class keystoneauth1.identity.v3.oauth2_client_credential.Mapping

Bases: Collection

A Mapping is a generic container for associating key/value pairs.

This class provides concrete generic implementations of all methods except for __getitem__, __iter__, and __len__.

__abstractmethods__ = frozenset({'__getitem__', '__iter__', '__len__'})
__annotations_cache__ = {}
__contains__(key)
__doc__ = 'A Mapping is a generic container for associating key/value\npairs.\n\nThis class provides concrete generic implementations of all\nmethods except for __getitem__, __iter__, and __len__.\n'
__eq__(other)

Return self==value.

__firstlineno__ = 775
abstractmethod __getitem__(key)
__hash__ = None
__module__ = 'collections.abc'
__reversed__ = None
__slots__ = ()
__static_attributes__ = ()
_abc_impl = <_abc._abc_data object>
get(k[, d]) → D[k] if k in D, else d.  d defaults to None.
items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
values() → an object providing a view on D's values
class keystoneauth1.identity.v3.oauth2_client_credential.OAuth2ClientCredential(auth_url: str, oauth2_endpoint: str, oauth2_client_id: str, oauth2_client_secret: str, *, trust_id: str | None = None, system_scope: str | None = None, domain_id: str | None = None, domain_name: str | None = None, project_id: str | None = None, project_name: str | None = None, project_domain_id: str | None = None, project_domain_name: str | None = None, reauthenticate: bool = True, include_catalog: bool = True)

Bases: Auth

A plugin for authenticating via an OAuth2.0 client credential.

Parameters:
  • auth_url – Identity service endpoint for authentication.

  • oauth2_endpoint – OAuth2.0 endpoint.

  • oauth2_client_id – OAuth2.0 client credential id.

  • oauth2_client_secret – OAuth2.0 client credential secret.

__abstractmethods__ = frozenset({})
__annotations_cache__ = {'MIN_TOKEN_LIFE_SECONDS': 'int', '_discovery_cache': 'dict[str, discover.Discover]', 'auth_ref': 'access.AccessInfo | None', 'auth_url': 'str', 'interactive_unscoped_auth': 'ClassVar[bool]', 'reauthenticate': 'bool'}
__doc__ = 'A plugin for authenticating via an OAuth2.0 client credential.\n\n:param auth_url: Identity service endpoint for authentication.\n:param oauth2_endpoint: OAuth2.0 endpoint.\n:param oauth2_client_id: OAuth2.0 client credential id.\n:param oauth2_client_secret: OAuth2.0 client credential secret.\n'
__firstlineno__ = 94
__init__(auth_url: str, oauth2_endpoint: str, oauth2_client_id: str, oauth2_client_secret: str, *, trust_id: str | None = None, system_scope: str | None = None, domain_id: str | None = None, domain_name: str | None = None, project_id: str | None = None, project_name: str | None = None, project_domain_id: str | None = None, project_domain_name: str | None = None, reauthenticate: bool = True, include_catalog: bool = True) → None
__module__ = 'keystoneauth1.identity.v3.oauth2_client_credential'
__static_attributes__ = ('oauth2_client_id', 'oauth2_client_secret', 'oauth2_endpoint')
_abc_impl = <_abc._abc_data object>
_auth_method_class

alias of OAuth2ClientCredentialMethod

_discovery_cache: dict[str, discover.Discover]
auth_ref: access.AccessInfo | None
auth_url: str
get_headers(session: Session) → dict[str, str] | None

Fetch authentication headers for message.

Parameters:

session – The session object that the auth_plugin belongs to.

Returns:

Headers that are set to authenticate a message or None for failure. Note that when checking this value that the empty dict is a valid, non-failure response.

reauthenticate: bool
class keystoneauth1.identity.v3.oauth2_client_credential.OAuth2ClientCredentialMethod(*, oauth2_endpoint: str, oauth2_client_id: str, oauth2_client_secret: str)

Bases: AuthMethod

An auth method to fetch a token via an OAuth2.0 client credential.

Parameters:
  • oauth2_endpoint – OAuth2.0 endpoint.

  • oauth2_client_id – OAuth2.0 client credential id.

  • oauth2_client_secret – OAuth2.0 client credential secret.

__abstractmethods__ = frozenset({})
__annotations_cache__ = {'_method_parameters': 'list[str] | None', 'oauth2_client_id': <class 'str'>, 'oauth2_client_secret': <class 'str'>, 'oauth2_endpoint': <class 'str'>}
__doc__ = 'An auth method to fetch a token via an OAuth2.0 client credential.\n\n:param oauth2_endpoint: OAuth2.0 endpoint.\n:param oauth2_client_id: OAuth2.0 client credential id.\n:param oauth2_client_secret: OAuth2.0 client credential secret.\n'
__firstlineno__ = 26
__init__(*, oauth2_endpoint: str, oauth2_client_id: str, oauth2_client_secret: str) → None
__module__ = 'keystoneauth1.identity.v3.oauth2_client_credential'
__static_attributes__ = ('oauth2_client_id', 'oauth2_client_secret', 'oauth2_endpoint')
_abc_impl = <_abc._abc_data object>
get_auth_data(session: Session, auth: Auth, headers: dict[str, str], request_kwargs: dict[str, object]) → tuple[None, None] | tuple[str, Mapping[str, object]]

Return the authentication section of an auth plugin.

Parameters:
  • session – The communication session.

  • auth – The auth plugin calling the method.

  • headers – The headers that will be sent with the auth request if a plugin needs to add to them.

Returns:

The identifier of this plugin and a dict of authentication data for the auth type.

get_cache_id_elements() → dict[str, str | None]

Get the elements for this auth method that make it unique.

These elements will be used as part of the keystoneauth1.plugin.BaseIdentityPlugin.get_cache_id() to allow caching of the auth plugin.

Plugins should override this if they want to allow caching of their state.

To avoid collision or overrides the keys of the returned dictionary should be prefixed with the plugin identifier. For example the password plugin returns its username value as ‘password_username’.

oauth2_client_id: str
oauth2_client_secret: str
oauth2_endpoint: str