troveclient.apiclient.auth module

class troveclient.apiclient.auth.BaseAuthPlugin(auth_system=None, **kwargs)

Bases: object

Base class for authentication plugins.

An authentication plugin needs to override at least the authenticate method to be a valid plugin.

classmethod add_common_opts(parser)

Add options that are common for several plugins.

classmethod add_opts(parser)

Populate the parser with the options for this plugin.

auth_system = None
authenticate(http_client)

Authenticate using plugin defined method.

The method usually analyses self.opts and performs a request to authentication server.

Parameters

http_client (troveclient.client.HTTPClient) – client object that needs authentication

Raises

AuthorizationFailure

common_opt_names = ['auth_system', 'username', 'password', 'tenant_name', 'token', 'auth_url']
static get_opt(opt_name, args)

Return option name and value.

Parameters
  • opt_name – name of the option, e.g., “username”

  • args – parsed arguments

opt_names = []
parse_opts(args)

Parse the actual auth-system options if any.

This method is expected to populate the attribute self.opts with a dict containing the options and values needed to make authentication.

sufficient_options()

Check if all required options are present.

Raises

AuthPluginOptionsMissing

abstract token_and_endpoint(endpoint_type, service_type)

Return token and endpoint.

Parameters
  • service_type (string) – Service type of the endpoint

  • endpoint_type (string) – Type of endpoint. Possible values: public or publicURL, internal or internalURL, admin or adminURL

Returns

tuple of token and endpoint strings

Raises

EndpointException

troveclient.apiclient.auth.discover_auth_systems()

Discover the available auth-systems.

This won’t take into account the old style auth-systems.

troveclient.apiclient.auth.load_auth_system_opts(parser)

Load options needed by the available auth-systems into a parser.

This function will try to populate the parser with options from the available plugins.

troveclient.apiclient.auth.load_plugin(auth_system)
troveclient.apiclient.auth.load_plugin_from_args(args)

Load required plugin and populate it with options.

Try to guess auth system if it is not specified. Systems are tried in alphabetical order.

Raises

AuthPluginOptionsMissing