From dfa1b417a8b1568694fea81171aa72b4c312fae7 Mon Sep 17 00:00:00 2001 From: Aditya Manthramurthy Date: Tue, 17 Sep 2019 13:29:31 -0700 Subject: [PATCH] Update comments in ldap example client code (#8257) --- docs/sts/ldap.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/docs/sts/ldap.go b/docs/sts/ldap.go index 2c993d8e5..2c4835f18 100644 --- a/docs/sts/ldap.go +++ b/docs/sts/ldap.go @@ -21,8 +21,8 @@ import ( "fmt" "log" - miniogo "github.com/minio/minio-go" - cr "github.com/minio/minio-go/pkg/credentials" + miniogo "github.com/minio/minio-go/v6" + cr "github.com/minio/minio-go/v6/pkg/credentials" ) var ( @@ -35,25 +35,29 @@ var ( ) func main() { + // The credentials package in minio-go provides an interface to call the + // LDAP STS API. - // If client machine is configured as a Kerberos client, just - // pass nil instead of `getKrbConfig()` below. + // Initialize LDAP credentials li, err := cr.NewLDAPIdentity(stsEndpoint, ldapUsername, ldapPassword) if err != nil { log.Fatalf("INIT Err: %v", err) } + // Generate temporary STS credentials v, err := li.Get() if err != nil { log.Fatalf("GET Err: %v", err) } fmt.Printf("%#v\n", v) + // Use generated credentials to authenticate with MinIO server minioClient, err := miniogo.NewWithCredentials("localhost:9000", li, false, "") if err != nil { log.Fatalln(err) } + // Use minIO Client object normally like the regular client. fmt.Println("Calling list buckets with temp creds:") b, err := minioClient.ListBuckets() if err != nil {