|
| 1 | +============== |
| 2 | +Authentication |
| 3 | +============== |
| 4 | + |
| 5 | +OpenStackClient leverages `python-keystoneclient`_ authentication |
| 6 | +plugins to support a number of different authentication methods. |
| 7 | + |
| 8 | +.. _`python-keystoneclient`: http://docs.openstack.org/developer/python-keystoneclient/authentication-plugins.html |
| 9 | + |
| 10 | +Authentication Process |
| 11 | +---------------------- |
| 12 | + |
| 13 | +The user provides some number of authentication credential options. |
| 14 | +If an authentication type is not provided (``--os-auth-type``), the |
| 15 | +authentication options are examined to determine if one of the default |
| 16 | +types can be used. If no match is found an error is reported and OSC exits. |
| 17 | + |
| 18 | +Note that the authentication call to the Identity service has not yet |
| 19 | +occurred. It is deferred until the last possible moment in order to |
| 20 | +reduce the number of unnecessary queries to the server, such as when further |
| 21 | +processing detects an invalid command. |
| 22 | + |
| 23 | +Authentication Plugins |
| 24 | +---------------------- |
| 25 | + |
| 26 | +The Keystone client library implements the base set of plugins. Additional |
| 27 | +plugins may be available from the Keystone project or other sources. |
| 28 | + |
| 29 | +There are at least three authentication types that are always available: |
| 30 | + |
| 31 | +* **Password**: A project, username and password are used to identify the |
| 32 | + user. An optional domain may also be included. This is the most common |
| 33 | + type and is the default any time a username is supplied. An authentication |
| 34 | + URL for the Identity service is also required. [Required: ``--os-auth-url``, |
| 35 | + ``--os-project-name``, ``--os-username``; Optional: ``--os-password``] |
| 36 | +* **Token**: This is slightly different from the usual token authentication |
| 37 | + (described below as token/endpoint) in that a token and an authentication |
| 38 | + URL are supplied and the plugin retrieves a new token. |
| 39 | + [Required: ``--os-auth-url``, ``--os-token``] |
| 40 | +* **Token/Endpoint**: This is the original token authentication (known as 'token |
| 41 | + flow' in the early CLI documentation in the OpenStack wiki). It requires |
| 42 | + a token and a direct endpoint that is used in the API call. The difference |
| 43 | + from the new Token type is this token is used as-is, no call is made |
| 44 | + to the Identity service from the client. This type is most often used to |
| 45 | + bootstrap a Keystone server where the token is the ``admin_token`` configured |
| 46 | + in ``keystone.conf``. It will also work with other services and a regular |
| 47 | + scoped token such as one obtained from a ``token issue`` command. |
| 48 | + [Required: ``--os-url``, ``--os-token``] |
| 49 | +* **Others**: Other authentication plugins such as SAML, Kerberos, and OAuth1.0 |
| 50 | + are under development and also supported. To use them, they must be selected |
| 51 | + by supplying the ``--os-auth-type`` option. |
| 52 | + |
| 53 | +Detailed Process |
| 54 | +---------------- |
| 55 | + |
| 56 | +The authentication process in OpenStackClient is all contained in and handled |
| 57 | +by the ``ClientManager`` object. |
| 58 | + |
| 59 | +* On import ``api.auth``: |
| 60 | + |
| 61 | + * obtains the list of installed Keystone authentication |
| 62 | + plugins from the ``keystoneclient.auth.plugin`` entry point. |
| 63 | + * builds a list of authentication options from the plugins. |
| 64 | + |
| 65 | +* A new ``ClientManager`` is created and supplied with the set of options from the |
| 66 | + command line and/or environment: |
| 67 | + |
| 68 | + * If ``--os-auth-type`` is provided and is a valid and available plugin |
| 69 | + it is used. |
| 70 | + * If ``--os-auth-type`` is not provided an authentication plugin |
| 71 | + is selected based on the existing options. This is a short-circuit |
| 72 | + evaluation, the first match wins. |
| 73 | + |
| 74 | + * If ``--os-endpoint`` and ``--os-token`` are both present ``token_endpoint`` |
| 75 | + is selected |
| 76 | + * If ``--os-username`` is supplied ``password`` is selected |
| 77 | + * If ``--os-token`` is supplied ``token`` is selected |
| 78 | + * If no selection has been made by now exit with error |
| 79 | + |
| 80 | + * Load the selected plugin class. |
| 81 | + |
| 82 | +* When an operation that requires authentication is attempted ``ClientManager`` |
| 83 | + makes the actual inital request to the Identity service. |
| 84 | + |
| 85 | + * if ``--os-auth-url`` is not supplied for any of the types except |
| 86 | + Token/Endpoint, exit with an error. |
0 commit comments