Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 1 | package gophercloud |
| 2 | |
Ash Wilson | 730a506 | 2014-10-31 15:13:35 -0400 | [diff] [blame] | 3 | /* |
| 4 | AuthOptions stores information needed to authenticate to an OpenStack cluster. |
| 5 | You can populate one manually, or use a provider's AuthOptionsFromEnv() function |
| 6 | to read relevant information from the standard environment variables. Pass one |
| 7 | to a provider's AuthenticatedClient function to authenticate and obtain a |
| 8 | ProviderClient representing an active session on that provider. |
| 9 | |
| 10 | Its fields are the union of those recognized by each identity implementation and |
| 11 | provider. |
| 12 | */ |
Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 13 | type AuthOptions struct { |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame] | 14 | // IdentityEndpoint specifies the HTTP endpoint that is required to work with |
Ash Wilson | 730a506 | 2014-10-31 15:13:35 -0400 | [diff] [blame] | 15 | // the Identity API of the appropriate version. While it's ultimately needed by |
| 16 | // all of the identity services, it will often be populated by a provider-level |
| 17 | // function. |
Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 18 | IdentityEndpoint string |
| 19 | |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame] | 20 | // Username is required if using Identity V2 API. Consult with your provider's |
| 21 | // control panel to discover your account's username. In Identity V3, either |
Ash Wilson | 730a506 | 2014-10-31 15:13:35 -0400 | [diff] [blame] | 22 | // UserID or a combination of Username and DomainID or DomainName are needed. |
Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 23 | Username, UserID string |
| 24 | |
Ash Wilson | 730a506 | 2014-10-31 15:13:35 -0400 | [diff] [blame] | 25 | // Exactly one of Password or APIKey is required for the Identity V2 and V3 |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame] | 26 | // APIs. Consult with your provider's control panel to discover your account's |
| 27 | // preferred method of authentication. |
Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 28 | Password, APIKey string |
| 29 | |
Jamie Hannaford | b280dea | 2014-10-24 15:14:06 +0200 | [diff] [blame] | 30 | // At most one of DomainID and DomainName must be provided if using Username |
| 31 | // with Identity V3. Otherwise, either are optional. |
Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 32 | DomainID, DomainName string |
| 33 | |
| 34 | // The TenantID and TenantName fields are optional for the Identity V2 API. |
| 35 | // Some providers allow you to specify a TenantName instead of the TenantId. |
Ash Wilson | 730a506 | 2014-10-31 15:13:35 -0400 | [diff] [blame] | 36 | // Some require both. Your provider's authentication policies will determine |
Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 37 | // how these fields influence authentication. |
| 38 | TenantID, TenantName string |
| 39 | |
| 40 | // AllowReauth should be set to true if you grant permission for Gophercloud to |
| 41 | // cache your credentials in memory, and to allow Gophercloud to attempt to |
| 42 | // re-authenticate automatically if/when your token expires. If you set it to |
| 43 | // false, it will not cache these settings, but re-authentication will not be |
| 44 | // possible. This setting defaults to false. |
Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 45 | AllowReauth bool |
jrperritt | 95b74c8 | 2015-07-28 20:39:27 -0600 | [diff] [blame^] | 46 | |
| 47 | // Token allows users to authenticate (possibly as another user) with an |
| 48 | // authentication token. |
| 49 | Token string |
Ash Wilson | 70dfe0c | 2014-08-28 13:57:09 -0400 | [diff] [blame] | 50 | } |