Identity v3 Authentication With TrustID (#24)
* delete auth_results
* v3 auth with trust
* define auth errors in gophercloud pkg
* AuthOptionsBuilder interface
* combine error files in gophercloud pkg
diff --git a/openstack/identity/v3/extensions/trusts/requests.go b/openstack/identity/v3/extensions/trusts/requests.go
new file mode 100644
index 0000000..999dd73
--- /dev/null
+++ b/openstack/identity/v3/extensions/trusts/requests.go
@@ -0,0 +1,34 @@
+package trusts
+
+import "github.com/gophercloud/gophercloud/openstack/identity/v3/tokens"
+
+type AuthOptsExt struct {
+ tokens.AuthOptionsBuilder
+ TrustID string `json:"id"`
+}
+
+func (opts AuthOptsExt) ToTokenV3CreateMap(scope map[string]interface{}) (map[string]interface{}, error) {
+ return opts.AuthOptionsBuilder.ToTokenV3CreateMap(scope)
+}
+
+func (opts AuthOptsExt) ToTokenV3ScopeMap() (map[string]interface{}, error) {
+ b, err := opts.AuthOptionsBuilder.ToTokenV3ScopeMap()
+ if err != nil {
+ return nil, err
+ }
+
+ if opts.TrustID != "" {
+ if b == nil {
+ b = make(map[string]interface{})
+ }
+ b["OS-TRUST:trust"] = map[string]interface{}{
+ "id": opts.TrustID,
+ }
+ }
+
+ return b, nil
+}
+
+func (opts AuthOptsExt) CanReauth() bool {
+ return opts.AuthOptionsBuilder.CanReauth()
+}