From e8160c9faef190a52b0cae49872c61f970bc99df Mon Sep 17 00:00:00 2001 From: Tim Hughes Date: Fri, 24 Apr 2020 06:14:45 +0100 Subject: [PATCH] fix: same endpoint for NewLDAPIdentity & NewWithCredentials (#9433) Also enables use of https endpoints Fixes #9431 --- docs/sts/ldap.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/docs/sts/ldap.go b/docs/sts/ldap.go index 5f6e61559..42b4a5fc3 100644 --- a/docs/sts/ldap.go +++ b/docs/sts/ldap.go @@ -21,6 +21,7 @@ import ( "flag" "fmt" "log" + "net/url" miniogo "github.com/minio/minio-go/v6" cr "github.com/minio/minio-go/v6/pkg/credentials" @@ -64,8 +65,18 @@ func main() { } fmt.Printf("%#v\n", v) + stsEndpointUrl, err := url.Parse(stsEndpoint) + if err != nil { + log.Fatalf("Err: %v", err) + } + + secure := false + if stsEndpointUrl.Scheme == "https" { + secure = true + } + // Use generated credentials to authenticate with MinIO server - minioClient, err := miniogo.NewWithCredentials("localhost:9000", li, false, "") + minioClient, err := miniogo.NewWithCredentials(stsEndpointUrl.Host, li, secure, "") if err != nil { log.Fatalln(err) }