mirror of
https://github.com/minio/minio.git
synced 2025-04-04 20:00:31 -04:00
Update comments in ldap example client code (#8257)
This commit is contained in:
parent
31bee6b6ed
commit
dfa1b417a8
@ -21,8 +21,8 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
miniogo "github.com/minio/minio-go"
|
miniogo "github.com/minio/minio-go/v6"
|
||||||
cr "github.com/minio/minio-go/pkg/credentials"
|
cr "github.com/minio/minio-go/v6/pkg/credentials"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -35,25 +35,29 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
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
|
// Initialize LDAP credentials
|
||||||
// pass nil instead of `getKrbConfig()` below.
|
|
||||||
li, err := cr.NewLDAPIdentity(stsEndpoint, ldapUsername, ldapPassword)
|
li, err := cr.NewLDAPIdentity(stsEndpoint, ldapUsername, ldapPassword)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("INIT Err: %v", err)
|
log.Fatalf("INIT Err: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Generate temporary STS credentials
|
||||||
v, err := li.Get()
|
v, err := li.Get()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("GET Err: %v", err)
|
log.Fatalf("GET Err: %v", err)
|
||||||
}
|
}
|
||||||
fmt.Printf("%#v\n", v)
|
fmt.Printf("%#v\n", v)
|
||||||
|
|
||||||
|
// Use generated credentials to authenticate with MinIO server
|
||||||
minioClient, err := miniogo.NewWithCredentials("localhost:9000", li, false, "")
|
minioClient, err := miniogo.NewWithCredentials("localhost:9000", li, false, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalln(err)
|
log.Fatalln(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Use minIO Client object normally like the regular client.
|
||||||
fmt.Println("Calling list buckets with temp creds:")
|
fmt.Println("Calling list buckets with temp creds:")
|
||||||
b, err := minioClient.ListBuckets()
|
b, err := minioClient.ListBuckets()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user