Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions auth_options.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,11 @@ type AuthOptions struct {
// AgencyNmae is the name of agnecy
AgencyName string `json:"xrole_name,omitempty"`

// AgencyDomainName is the domain name who created the agency
AgencyDomainName string `json:"domain_name,omitempty"`
// DelegatedDomain is the name of delegated domain
DelegatedDomain string `json:"domain_name,omitempty"`

// AgencyProjectName is the project name of agency
AgencyProjectName string
// DelegatedProject is the name of delegated project
DelegatedProject string
}

// ToTokenV2CreateMap allows AuthOptions to satisfy the AuthOptionsBuilder
Expand Down Expand Up @@ -375,10 +375,10 @@ func (scope *scopeInfo) BuildTokenV3ScopeMap() (map[string]interface{}, error) {
}

type AgencyAuthOptions struct {
TokenID string
AgencyName string
AgencyDomainName string
AgencyProjectName string
TokenID string
AgencyName string
DelegatedDomain string
DelegatedProject string
}

func (opts *AgencyAuthOptions) CanReauth() bool {
Expand All @@ -391,8 +391,8 @@ func (opts *AgencyAuthOptions) AuthTokenID() string {

func (opts *AgencyAuthOptions) ToTokenV3ScopeMap() (map[string]interface{}, error) {
scope := scopeInfo{
ProjectName: opts.AgencyProjectName,
DomainName: opts.AgencyDomainName,
ProjectName: opts.DelegatedProject,
DomainName: opts.DelegatedDomain,
}

return scope.BuildTokenV3ScopeMap()
Expand All @@ -416,7 +416,7 @@ func (opts *AgencyAuthOptions) ToTokenV3CreateMap(scope map[string]interface{})
var req authReq
req.Identity.Methods = []string{"assume_role"}
req.Identity.AssumeRole = assumeRoleReq{
DomainName: opts.AgencyDomainName,
DomainName: opts.DelegatedDomain,
AgencyName: opts.AgencyName,
}
r, err := BuildRequestBody(req, "auth")
Expand Down
10 changes: 5 additions & 5 deletions openstack/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,12 @@ func v3auth(client *golangsdk.ProviderClient, endpoint string, opts tokens3.Auth
}

opts1, ok := opts.(*golangsdk.AuthOptions)
if ok && opts1.AgencyDomainName != "" && opts1.AgencyName != "" {
if ok && opts1.DelegatedDomain != "" && opts1.AgencyName != "" {
opts2 := golangsdk.AgencyAuthOptions{
TokenID: token.ID,
AgencyName: opts1.AgencyName,
AgencyDomainName: opts1.AgencyDomainName,
AgencyProjectName: opts1.AgencyProjectName,
TokenID: token.ID,
AgencyName: opts1.AgencyName,
DelegatedDomain: opts1.DelegatedDomain,
DelegatedProject: opts1.DelegatedProject,
}
result = tokens3.Create(v3Client, &opts2)
token, err = result.ExtractToken()
Expand Down