Skip to content

Commit d708520

Browse files
authored
Add possibility to set AllowReauth in clientOpts (#162)
* Add possibility to set AllowReauth in clientOpts Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com> * Remove setting AllowReauth in terraform auth config AuthInfo struct Removed in favor of lines 161-162 Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com> * Set AllowReauth from *bool to bool to simplify the code and avoid nil pointer access Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com> * Remove out-of-context comment about AllowReauth Signed-off-by: Ondrej Vasko <ondrej.vaskoo@gmail.com>
1 parent bfd0103 commit d708520

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

openstack/clientconfig/requests.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ func AuthOptions(opts *ClientOpts) (*gophercloud.AuthOptions, error) {
375375

376376
// If cloud.AuthInfo is nil, then no cloud was specified.
377377
if cloud.AuthInfo == nil {
378-
// If opts.Auth is not nil, then try using the auth settings from it.
378+
// If opts.AuthInfo is not nil, then try using the auth settings from it.
379379
if opts.AuthInfo != nil {
380380
cloud.AuthInfo = opts.AuthInfo
381381
}
@@ -512,6 +512,7 @@ func v2auth(cloud *Cloud, opts *ClientOpts) (*gophercloud.AuthOptions, error) {
512512
Password: cloud.AuthInfo.Password,
513513
TenantID: cloud.AuthInfo.ProjectID,
514514
TenantName: cloud.AuthInfo.ProjectName,
515+
AllowReauth: cloud.AuthInfo.AllowReauth,
515516
}
516517

517518
return ao, nil
@@ -684,6 +685,7 @@ func v3auth(cloud *Cloud, opts *ClientOpts) (*gophercloud.AuthOptions, error) {
684685
ApplicationCredentialID: cloud.AuthInfo.ApplicationCredentialID,
685686
ApplicationCredentialName: cloud.AuthInfo.ApplicationCredentialName,
686687
ApplicationCredentialSecret: cloud.AuthInfo.ApplicationCredentialSecret,
688+
AllowReauth: cloud.AuthInfo.AllowReauth,
687689
}
688690

689691
// If an auth_type of "token" was specified, then make sure

openstack/clientconfig/results.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,13 @@ type AuthInfo struct {
126126
// DefaultDomain is the domain ID to fall back on if no other domain has
127127
// been specified and a domain is required for scope.
128128
DefaultDomain string `yaml:"default_domain,omitempty" json:"default_domain,omitempty"`
129+
130+
// AllowReauth should be set to true if you grant permission for Gophercloud to
131+
// cache your credentials in memory, and to allow Gophercloud to attempt to
132+
// re-authenticate automatically if/when your token expires. If you set it to
133+
// false, it will not cache these settings, but re-authentication will not be
134+
// possible. This setting defaults to false.
135+
AllowReauth bool `yaml:"allow_reauth,omitempty" json:"allow_reauth,omitempty"`
129136
}
130137

131138
// Region represents a region included as part of cloud in clouds.yaml

0 commit comments

Comments
 (0)