keystoneauth1.token_endpoint module

keystoneauth1.token_endpoint module

class keystoneauth1.token_endpoint.Token(endpoint, token)

Bases: keystoneauth1.plugin.BaseAuthPlugin

A provider that will always use the given token and endpoint.

This is really only useful for testing and in certain CLI cases where you have a known endpoint and admin token that you want to use.

get_auth_ref(session, **kwargs)

Return the authentication reference of an auth plugin.

Parameters

session (keystoneauth1.session.session) – A session object to be used for communication

get_endpoint(session, **kwargs)

Return the supplied endpoint.

Using this plugin the same endpoint is returned regardless of the parameters passed to the plugin.

get_endpoint_data(session, endpoint_override=None, discover_versions=True, **kwargs)

Return a valid endpoint data for a the service.

Parameters
  • session (keystoneauth1.session.Session) – A session object that can be used for communication.

  • endpoint_override (str) – URL to use for version discovery other than the endpoint stored in the plugin. (optional, defaults to None)

  • discover_versions (bool) – Whether to get version metadata from the version discovery document even if it major api version info can be inferred from the url. (optional, defaults to True)

  • kwargs – Ignored.

Raises

keystoneauth1.exceptions.http.HttpError – An error from an invalid HTTP response.

Returns

Valid EndpointData or None if not available.

Return type

keystoneauth1.discover.EndpointData or None

get_token(session)

Obtain a token.

How the token is obtained is up to the plugin. If it is still valid it may be re-used, retrieved from cache or invoke an authentication request against a server.

There are no required kwargs. They are passed directly to the auth plugin and they are implementation specific.

Returning None will indicate that no token was able to be retrieved.

This function is misplaced as it should only be required for auth plugins that use the ‘X-Auth-Token’ header. However due to the way plugins evolved this method is required and often called to trigger an authentication request on a new plugin.

When implementing a new plugin it is advised that you implement this method, however if you don’t require the ‘X-Auth-Token’ header override the get_headers method instead.

Parameters

session (keystoneauth1.session.Session) – A session object so the plugin can make HTTP calls.

Returns

A token to use.

Return type

string

Creative Commons Attribution 3.0 License

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.