blob: 5102f09d12d221938af256076fc9600926a8c3ca [file] [log] [blame]
Ash Wilson70dfe0c2014-08-28 13:57:09 -04001package gophercloud
2
Ash Wilson730a5062014-10-31 15:13:35 -04003/*
4AuthOptions stores information needed to authenticate to an OpenStack cluster.
5You can populate one manually, or use a provider's AuthOptionsFromEnv() function
6to read relevant information from the standard environment variables. Pass one
7to a provider's AuthenticatedClient function to authenticate and obtain a
8ProviderClient representing an active session on that provider.
9
10Its fields are the union of those recognized by each identity implementation and
11provider.
12*/
Ash Wilson70dfe0c2014-08-28 13:57:09 -040013type AuthOptions struct {
Jamie Hannafordb280dea2014-10-24 15:14:06 +020014 // IdentityEndpoint specifies the HTTP endpoint that is required to work with
Ash Wilson730a5062014-10-31 15:13:35 -040015 // 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.
Jon Perrittdb0ae142016-03-13 00:33:41 -060018 IdentityEndpoint string `json:"-"`
Ash Wilson70dfe0c2014-08-28 13:57:09 -040019
Jamie Hannafordb280dea2014-10-24 15:14:06 +020020 // 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 Wilson730a5062014-10-31 15:13:35 -040022 // UserID or a combination of Username and DomainID or DomainName are needed.
Jon Perrittdb0ae142016-03-13 00:33:41 -060023 Username string `json:"username,omitempty"`
24 UserID string `json:"id,omitempty"`
Ash Wilson70dfe0c2014-08-28 13:57:09 -040025
Jon Perrittdb0ae142016-03-13 00:33:41 -060026 Password string `json:"password,omitempty"`
Ash Wilson70dfe0c2014-08-28 13:57:09 -040027
Jamie Hannafordb280dea2014-10-24 15:14:06 +020028 // At most one of DomainID and DomainName must be provided if using Username
29 // with Identity V3. Otherwise, either are optional.
Jon Perrittdb0ae142016-03-13 00:33:41 -060030 DomainID string `json:"id,omitempty"`
31 DomainName string `json:"name,omitempty"`
Ash Wilson70dfe0c2014-08-28 13:57:09 -040032
33 // The TenantID and TenantName fields are optional for the Identity V2 API.
34 // Some providers allow you to specify a TenantName instead of the TenantId.
Ash Wilson730a5062014-10-31 15:13:35 -040035 // Some require both. Your provider's authentication policies will determine
Ash Wilson70dfe0c2014-08-28 13:57:09 -040036 // how these fields influence authentication.
Jon Perrittdb0ae142016-03-13 00:33:41 -060037 TenantID string `json:"tenantId,omitempty"`
38 TenantName string `json:"tenantName,omitempty"`
Ash Wilson70dfe0c2014-08-28 13:57:09 -040039
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.
Jon Perrittdb0ae142016-03-13 00:33:41 -060045 AllowReauth bool `json:"-"`
jrperritt95b74c82015-07-28 20:39:27 -060046
jrperritt1f218c82015-07-29 08:54:18 -060047 // TokenID allows users to authenticate (possibly as another user) with an
48 // authentication token ID.
49 TokenID string
Ash Wilson70dfe0c2014-08-28 13:57:09 -040050}