summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/minio/minio-go/pkg/credentials
diff options
context:
space:
mode:
authorChristopher Speller <crspeller@gmail.com>2018-01-29 14:17:40 -0800
committerGitHub <noreply@github.com>2018-01-29 14:17:40 -0800
commit961c04cae992eadb42d286d2f85f8a675bdc68c8 (patch)
tree3408f2d06f847e966c53485e2d54c692cdd037c1 /vendor/github.com/minio/minio-go/pkg/credentials
parent8d66523ba7d9a77129844be476732ebfd5272d64 (diff)
downloadchat-961c04cae992eadb42d286d2f85f8a675bdc68c8.tar.gz
chat-961c04cae992eadb42d286d2f85f8a675bdc68c8.tar.bz2
chat-961c04cae992eadb42d286d2f85f8a675bdc68c8.zip
Upgrading server dependancies (#8154)
Diffstat (limited to 'vendor/github.com/minio/minio-go/pkg/credentials')
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/chain.go34
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/chain_test.go11
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/credentials.go2
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/credentials_test.go2
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/doc.go17
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/env_aws.go2
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/env_minio.go2
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/env_test.go2
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/file_aws_credentials.go4
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/file_minio_client.go4
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/file_test.go2
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/iam_aws.go17
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/iam_aws_test.go17
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/signature-type.go3
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/static.go2
-rw-r--r--vendor/github.com/minio/minio-go/pkg/credentials/static_test.go2
16 files changed, 76 insertions, 47 deletions
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/chain.go b/vendor/github.com/minio/minio-go/pkg/credentials/chain.go
index 6b0e57440..e29826f48 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/chain.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/chain.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,8 +17,6 @@
package credentials
-import "fmt"
-
// A Chain will search for a provider which returns credentials
// and cache that provider until Retrieve is called again.
//
@@ -27,11 +25,11 @@ import "fmt"
// Providers in the list.
//
// If none of the Providers retrieve valid credentials Value, ChainProvider's
-// Retrieve() will return the error, collecting all errors from all providers.
+// Retrieve() will return the no credentials value.
//
// If a Provider is found which returns valid credentials Value ChainProvider
// will cache that Provider for all calls to IsExpired(), until Retrieve is
-// called again.
+// called again after IsExpired() is true.
//
// creds := credentials.NewChainCredentials(
// []credentials.Provider{
@@ -58,28 +56,30 @@ func NewChainCredentials(providers []Provider) *Credentials {
})
}
-// Retrieve returns the credentials value or error if no provider returned
-// without error.
+// Retrieve returns the credentials value, returns no credentials(anonymous)
+// if no credentials provider returned any value.
//
-// If a provider is found it will be cached and any calls to IsExpired()
-// will return the expired state of the cached provider.
+// If a provider is found with credentials, it will be cached and any calls
+// to IsExpired() will return the expired state of the cached provider.
func (c *Chain) Retrieve() (Value, error) {
- var errs []error
for _, p := range c.Providers {
- creds, err := p.Retrieve()
- if err != nil {
- errs = append(errs, err)
+ creds, _ := p.Retrieve()
+ // Always prioritize non-anonymous providers, if any.
+ if creds.AccessKeyID == "" && creds.SecretAccessKey == "" {
continue
- } // Success.
+ }
c.curr = p
return creds, nil
}
- c.curr = nil
- return Value{}, fmt.Errorf("No valid providers found %v", errs)
+ // At this point we have exhausted all the providers and
+ // are left without any credentials return anonymous.
+ return Value{
+ SignerType: SignatureAnonymous,
+ }, nil
}
// IsExpired will returned the expired state of the currently cached provider
-// if there is one. If there is no current provider, true will be returned.
+// if there is one. If there is no current provider, true will be returned.
func (c *Chain) IsExpired() bool {
if c.curr != nil {
return c.curr.IsExpired()
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/chain_test.go b/vendor/github.com/minio/minio-go/pkg/credentials/chain_test.go
index cb5a6dda5..d26e376ff 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/chain_test.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/chain_test.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -76,7 +76,14 @@ func TestChainGet(t *testing.T) {
}
func TestChainIsExpired(t *testing.T) {
- credProvider := &credProvider{expired: true}
+ credProvider := &credProvider{
+ creds: Value{
+ AccessKeyID: "UXHW",
+ SecretAccessKey: "MYSECRET",
+ SessionToken: "",
+ },
+ expired: true,
+ }
p := &Chain{
Providers: []Provider{
credProvider,
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/credentials.go b/vendor/github.com/minio/minio-go/pkg/credentials/credentials.go
index cc3000532..4bfdad413 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/credentials.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/credentials.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/credentials_test.go b/vendor/github.com/minio/minio-go/pkg/credentials/credentials_test.go
index cbfb673b7..92c77c4cb 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/credentials_test.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/credentials_test.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/doc.go b/vendor/github.com/minio/minio-go/pkg/credentials/doc.go
index fa1908aeb..c48784ba8 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/doc.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/doc.go
@@ -1,3 +1,20 @@
+/*
+ * Minio Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 Minio, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
// Package credentials provides credential retrieval and management
// for S3 compatible object storage.
//
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/env_aws.go b/vendor/github.com/minio/minio-go/pkg/credentials/env_aws.go
index 11934433c..f9b2cc33a 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/env_aws.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/env_aws.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/env_minio.go b/vendor/github.com/minio/minio-go/pkg/credentials/env_minio.go
index 791087ef5..d72e77185 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/env_minio.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/env_minio.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/env_test.go b/vendor/github.com/minio/minio-go/pkg/credentials/env_test.go
index 2f72bea40..09cd77f7a 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/env_test.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/env_test.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/file_aws_credentials.go b/vendor/github.com/minio/minio-go/pkg/credentials/file_aws_credentials.go
index 1be621385..5ad68303a 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/file_aws_credentials.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/file_aws_credentials.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@ import (
"path/filepath"
"github.com/go-ini/ini"
- homedir "github.com/minio/go-homedir"
+ homedir "github.com/mitchellh/go-homedir"
)
// A FileAWSCredentials retrieves credentials from the current user's home
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/file_minio_client.go b/vendor/github.com/minio/minio-go/pkg/credentials/file_minio_client.go
index 9e26dd302..c282c2a2c 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/file_minio_client.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/file_minio_client.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,7 +24,7 @@ import (
"path/filepath"
"runtime"
- homedir "github.com/minio/go-homedir"
+ homedir "github.com/mitchellh/go-homedir"
)
// A FileMinioClient retrieves credentials from the current user's home
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/file_test.go b/vendor/github.com/minio/minio-go/pkg/credentials/file_test.go
index c62c53365..c85c10494 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/file_test.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/file_test.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/iam_aws.go b/vendor/github.com/minio/minio-go/pkg/credentials/iam_aws.go
index b862cf538..637df7466 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/iam_aws.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/iam_aws.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -46,18 +46,6 @@ type IAM struct {
endpoint string
}
-// redirectHeaders copies all headers when following a redirect URL.
-// This won't be needed anymore from go 1.8 (https://github.com/golang/go/issues/4800)
-func redirectHeaders(req *http.Request, via []*http.Request) error {
- if len(via) == 0 {
- return nil
- }
- for key, val := range via[0].Header {
- req.Header[key] = val
- }
- return nil
-}
-
// IAM Roles for Amazon EC2
// http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
const (
@@ -74,8 +62,7 @@ func NewIAM(endpoint string) *Credentials {
}
p := &IAM{
Client: &http.Client{
- Transport: http.DefaultTransport,
- CheckRedirect: redirectHeaders,
+ Transport: http.DefaultTransport,
},
endpoint: endpoint,
}
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/iam_aws_test.go b/vendor/github.com/minio/minio-go/pkg/credentials/iam_aws_test.go
index 3e5ad3ec0..86ea66bf6 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/iam_aws_test.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/iam_aws_test.go
@@ -1,3 +1,20 @@
+/*
+ * Minio Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 Minio, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
package credentials
import (
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/signature-type.go b/vendor/github.com/minio/minio-go/pkg/credentials/signature-type.go
index c64ad6c23..1b768e8c3 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/signature-type.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/signature-type.go
@@ -1,5 +1,6 @@
/*
- * Minio Go Library for Amazon S3 Compatible Cloud Storage (C) 2017 Minio, Inc.
+ * Minio Go Library for Amazon S3 Compatible Cloud Storage
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/static.go b/vendor/github.com/minio/minio-go/pkg/credentials/static.go
index 25aff5696..8b0ba711c 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/static.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/static.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/vendor/github.com/minio/minio-go/pkg/credentials/static_test.go b/vendor/github.com/minio/minio-go/pkg/credentials/static_test.go
index 491b1554b..f1d2d856c 100644
--- a/vendor/github.com/minio/minio-go/pkg/credentials/static_test.go
+++ b/vendor/github.com/minio/minio-go/pkg/credentials/static_test.go
@@ -1,6 +1,6 @@
/*
* Minio Go Library for Amazon S3 Compatible Cloud Storage
- * (C) 2017 Minio, Inc.
+ * Copyright 2017 Minio, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.