keystoneauth1.token_endpoint module¶
- class keystoneauth1.token_endpoint.Token(endpoint: str | None, token: str | None)
Bases:
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.
- __annotations__ = {}
- __doc__ = 'A provider that will always use the given token and endpoint.\n\n This is really only useful for testing and in certain CLI cases where you\n have a known endpoint and admin token that you want to use.\n '
- __module__ = 'keystoneauth1.token_endpoint'
- get_auth_ref(session: ks_session.Session) access.AccessInfo | None
Return the authentication reference of an auth plugin.
- Parameters:
session (keystoneauth1.session.session) – A session object to be used for communication
- get_endpoint(session: ks_session.Session, **kwargs: Any) str | None
Return the supplied endpoint.
Using this plugin the same endpoint is returned regardless of the parameters passed to the plugin.
- get_endpoint_data(session: ks_session.Session, *, endpoint_override: str | None = None, discover_versions: bool = True, **kwargs: Any) EndpointData | None
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: ks_session.Session) str | None
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.
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