Add global Authenticate() function.
Also finishes work started in last commit.
diff --git a/authenticate_test.go b/authenticate_test.go
index 0402e2a..f077dab 100644
--- a/authenticate_test.go
+++ b/authenticate_test.go
@@ -148,7 +148,7 @@
return
}
- err = c.RegisterProvider("provider", &Provider{AuthEndpoint: "/"})
+ err = c.RegisterProvider("provider", Provider{AuthEndpoint: "/"})
if err != nil {
t.Error(err)
return
@@ -170,7 +170,7 @@
c.UseCustomClient(&http.Client{
Transport: tt,
})
- c.RegisterProvider("provider", &Provider{AuthEndpoint: "/"})
+ c.RegisterProvider("provider", Provider{AuthEndpoint: "/"})
tt.expectTenantId = false
_, err := c.Authenticate("provider", AuthOptions{
@@ -205,7 +205,7 @@
func TestUserNameAndPassword(t *testing.T) {
c := TestContext()
c.UseCustomClient(&http.Client{Transport: &testTransport{}})
- c.RegisterProvider("provider", &Provider{AuthEndpoint: "http://localhost/"})
+ c.RegisterProvider("provider", Provider{AuthEndpoint: "http://localhost/"})
credentials := []AuthOptions{
AuthOptions{},
@@ -232,7 +232,7 @@
tt := &testTransport{}
tt.response = SUCCESSFUL_RESPONSE
c.UseCustomClient(&http.Client{Transport: tt})
- c.RegisterProvider("provider", &Provider{AuthEndpoint: "http://localhost"})
+ c.RegisterProvider("provider", Provider{AuthEndpoint: "http://localhost"})
acc, err := c.Authenticate("provider", AuthOptions{Username: "u", Password: "p"})
if err != nil {
@@ -252,7 +252,7 @@
tt := &testTransport{}
tt.response = SUCCESSFUL_RESPONSE
c.UseCustomClient(&http.Client{Transport: tt})
- c.RegisterProvider("provider", &Provider{AuthEndpoint: "http://localhost"})
+ c.RegisterProvider("provider", Provider{AuthEndpoint: "http://localhost"})
acc, err := c.Authenticate("provider", AuthOptions{Username: "u", Password: "p"})
if err != nil {
@@ -266,8 +266,8 @@
return
}
- types := map[string]bool {
- "compute": true,
+ types := map[string]bool{
+ "compute": true,
"rax:database": true,
}
for _, entry := range svcs {
@@ -283,7 +283,7 @@
tt := &testTransport{}
tt.response = SUCCESSFUL_RESPONSE
c.UseCustomClient(&http.Client{Transport: tt})
- c.RegisterProvider("provider", &Provider{AuthEndpoint: "http://localhost"})
+ c.RegisterProvider("provider", Provider{AuthEndpoint: "http://localhost"})
acc, err := c.Authenticate("provider", AuthOptions{Username: "u", Password: "p"})
if err != nil {
@@ -296,4 +296,4 @@
t.Error("Expected user ID of 16148; got", u.Id)
return
}
-}
\ No newline at end of file
+}