@@ -7,34 +7,35 @@ import (
7
7
)
8
8
9
9
type AuthOptionsExt struct {
10
- token3.AuthOptions
11
- TrustID string
10
+ token3.AuthOptions
11
+ TrustID string
12
12
}
13
13
14
14
func (ao AuthOptionsExt ) ToAuthOptionsV3Map (c * gophercloud.ServiceClient , scope * token3.Scope ) (map [string ]interface {}, error ) {
15
15
//Passing scope value to nil to add scope later in this function.
16
16
authMap , err := ao .AuthOptions .ToAuthOptionsV3Map (c , nil )
17
- if err != nil {
18
- return nil , err
19
- }
17
+ if err != nil {
18
+ return nil , err
19
+ }
20
+ authMap = authMap ["auth" ].(map [string ]interface {})
20
21
21
22
// Add a "scope" element if a Scope has been provided.
22
23
if ao .TrustID != "" {
23
- // TrustID provided.
24
- authMap ["scope" ] = map [string ]interface {}{
25
- "OS-TRUST:trust" : map [string ]interface {}{
26
- "id" : ao .TrustID ,
27
- },
28
- }
29
- } else {
30
- return nil , token3 .ErrScopeEmpty
24
+ // TrustID provided.
25
+ authMap ["scope" ] = map [string ]interface {}{
26
+ "OS-TRUST:trust" : map [string ]interface {}{
27
+ "id" : ao .TrustID ,
28
+ },
29
+ }
30
+ } else {
31
+ return nil , token3 .ErrScopeEmpty
31
32
}
32
- return authMap , nil
33
+ return map [ string ] interface {}{ "auth" : authMap } , nil
33
34
}
34
35
35
36
// AuthenticateV3 explicitly authenticates against the identity v3 service.
36
37
func AuthenticateV3Trust (client * gophercloud.ProviderClient , options AuthOptionsExt ) error {
37
- return trustv3auth (client , "" , options )
38
+ return trustv3auth (client , "" , options )
38
39
}
39
40
40
41
func trustv3auth (client * gophercloud.ProviderClient , endpoint string , options AuthOptionsExt ) error {
0 commit comments