keystoneauth1.identity.v3.oauth2_client_credential module

class keystoneauth1.identity.v3.oauth2_client_credential.OAuth2ClientCredential(auth_url, *args, **kwargs)

Bases: AuthConstructor

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

Parameters:
  • auth_url (string) – Identity service endpoint for authentication.

  • oauth2_endpoint (string) – OAuth2.0 endpoint.

  • oauth2_client_id (string) – OAuth2.0 client credential id.

  • oauth2_client_secret (string) – OAuth2.0 client credential secret.

get_headers(session, **kwargs)

Fetch authentication headers for message.

Parameters:

session (keystoneauth1.session.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.

Return type:

dict

class keystoneauth1.identity.v3.oauth2_client_credential.OAuth2ClientCredentialMethod(**kwargs)

Bases: AuthMethod

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

Parameters:
  • oauth2_endpoint (string) – OAuth2.0 endpoint.

  • oauth2_client_id (string) – OAuth2.0 client credential id.

  • oauth2_client_secret (string) – OAuth2.0 client credential secret.

get_auth_data(session, auth, headers, **kwargs)

Return the authentication section of an auth plugin.

Parameters:
  • session (keystoneauth1.session.Session) – The communication session.

  • auth (base.Auth) – The auth plugin calling the method.

  • headers (dict) – 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.

Return type:

tuple(string, dict)

get_cache_id_elements()

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’.