Removed mixed dev work; focus returns to 0.2.0 API
diff --git a/acceptance/openstack/identity/01-authenticate.go b/acceptance/openstack/identity/01-authenticate.go
index d41bf01..cb766f8 100644
--- a/acceptance/openstack/identity/01-authenticate.go
+++ b/acceptance/openstack/identity/01-authenticate.go
@@ -9,22 +9,27 @@
type extractor func(*identity.TokenDesc) string
func main() {
+ // Create an initialized set of authentication options based on available OS_*
+ // environment variables.
ao, err := utils.AuthOptions()
if err != nil {
panic(err)
}
- ao.AllowReauth = true
+ // Attempt to authenticate with them.
r, err := identity.Authenticate(ao)
if err != nil {
panic(err)
}
+ // We're authenticated; now let's grab our authentication token.
t, err := identity.Token(r)
if err != nil {
panic(err)
}
+ // Authentication tokens have a variety of fields which might be of some interest.
+ // Let's print a few of them out.
table := map[string]extractor{
"ID": func(t *identity.TokenDesc) string { return t.Id() },
"Expires": func(t *identity.TokenDesc) string { return t.Expires() },
@@ -34,16 +39,23 @@
fmt.Printf("Your token's %s is %s\n", attr, fn(t))
}
+ // With each authentication, you receive a master directory of all the services
+ // your account can access. This "service catalog", as OpenStack calls it,
+ // provides you the means to exploit other OpenStack services.
sc, err := identity.ServiceCatalog(r)
if err != nil {
panic(err)
}
+
+ // Different providers will provide different services. Let's print them
+ // in summary.
ces, err := sc.CatalogEntries()
fmt.Printf("Service Catalog Summary:\n %32s %-16s\n", "Name", "Type")
for _, ce := range ces {
fmt.Printf(" %32s | %-16s\n", ce.Name, ce.Type)
}
+ // Now let's print them in greater detail.
for _, ce := range ces {
fmt.Printf("Endpoints for %s/%s\n", ce.Name, ce.Type)
for _, ep := range ce.Endpoints {
@@ -55,3 +67,4 @@
}
}
}
+