mirror of
https://github.com/minio/minio.git
synced 2024-12-26 23:25:54 -05:00
Merge pull request #981 from harshavardhana/signature
signature/region: Remove 'milkyway' and use 'us-east-1' as default.
This commit is contained in:
commit
3986e3cf2b
@ -23,11 +23,11 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
// Create an S3 service object in the "milkyway" region
|
// Create an S3 service object in the default region.
|
||||||
s3Client := s3.New(&aws.Config{
|
s3Client := s3.New(&aws.Config{
|
||||||
Credentials: credentials.NewStaticCredentials("<YOUR-ACCESS-ID>", "<YOUR-SECRET-ID>", ""),
|
Credentials: credentials.NewStaticCredentials("<YOUR-ACCESS-ID>", "<YOUR-SECRET-ID>", ""),
|
||||||
Endpoint: aws.String("http://localhost:9000"),
|
Endpoint: aws.String("http://localhost:9000"),
|
||||||
Region: aws.String("milkyway"),
|
Region: aws.String("us-east-1"),
|
||||||
DisableSSL: aws.Bool(true),
|
DisableSSL: aws.Bool(true),
|
||||||
S3ForcePathStyle: aws.Bool(true),
|
S3ForcePathStyle: aws.Bool(true),
|
||||||
})
|
})
|
||||||
|
@ -213,7 +213,7 @@ var errorCodeResponse = map[int]APIError{
|
|||||||
},
|
},
|
||||||
AuthorizationHeaderMalformed: {
|
AuthorizationHeaderMalformed: {
|
||||||
Code: "AuthorizationHeaderMalformed",
|
Code: "AuthorizationHeaderMalformed",
|
||||||
Description: "The authorization header is malformed; the region is wrong; expecting 'milkyway'.",
|
Description: "The authorization header is malformed; the region is wrong; expecting 'us-east-1'.",
|
||||||
HTTPStatusCode: http.StatusBadRequest,
|
HTTPStatusCode: http.StatusBadRequest,
|
||||||
},
|
},
|
||||||
MalformedPOSTRequest: {
|
MalformedPOSTRequest: {
|
||||||
|
@ -77,7 +77,7 @@ func isValidRegion(authHeaderValue string) *probe.Error {
|
|||||||
return err.Trace()
|
return err.Trace()
|
||||||
}
|
}
|
||||||
region := credentialElements[2]
|
region := credentialElements[2]
|
||||||
if region != "milkyway" {
|
if region != "us-east-1" {
|
||||||
return probe.NewError(errInvalidRegion)
|
return probe.NewError(errInvalidRegion)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
@ -210,7 +210,7 @@ func (r Signature) getPresignedCanonicalRequest(presignedQuery string) string {
|
|||||||
func (r Signature) getScope(t time.Time) string {
|
func (r Signature) getScope(t time.Time) string {
|
||||||
scope := strings.Join([]string{
|
scope := strings.Join([]string{
|
||||||
t.Format(yyyymmdd),
|
t.Format(yyyymmdd),
|
||||||
"milkyway",
|
"us-east-1",
|
||||||
"s3",
|
"s3",
|
||||||
"aws4_request",
|
"aws4_request",
|
||||||
}, "/")
|
}, "/")
|
||||||
@ -229,7 +229,7 @@ func (r Signature) getStringToSign(canonicalRequest string, t time.Time) string
|
|||||||
func (r Signature) getSigningKey(t time.Time) []byte {
|
func (r Signature) getSigningKey(t time.Time) []byte {
|
||||||
secret := r.SecretAccessKey
|
secret := r.SecretAccessKey
|
||||||
date := sumHMAC([]byte("AWS4"+secret), []byte(t.Format(yyyymmdd)))
|
date := sumHMAC([]byte("AWS4"+secret), []byte(t.Format(yyyymmdd)))
|
||||||
region := sumHMAC(date, []byte("milkyway"))
|
region := sumHMAC(date, []byte("us-east-1"))
|
||||||
service := sumHMAC(region, []byte("s3"))
|
service := sumHMAC(region, []byte("s3"))
|
||||||
signingKey := sumHMAC(service, []byte("aws4_request"))
|
signingKey := sumHMAC(service, []byte("aws4_request"))
|
||||||
return signingKey
|
return signingKey
|
||||||
|
@ -234,7 +234,7 @@ func (s *MyAPIFSCacheSuite) newRequest(method, urlStr string, contentLength int6
|
|||||||
|
|
||||||
scope := strings.Join([]string{
|
scope := strings.Join([]string{
|
||||||
t.Format(yyyymmdd),
|
t.Format(yyyymmdd),
|
||||||
"milkyway",
|
"us-east-1",
|
||||||
"s3",
|
"s3",
|
||||||
"aws4_request",
|
"aws4_request",
|
||||||
}, "/")
|
}, "/")
|
||||||
@ -244,7 +244,7 @@ func (s *MyAPIFSCacheSuite) newRequest(method, urlStr string, contentLength int6
|
|||||||
stringToSign = stringToSign + hex.EncodeToString(sum256([]byte(canonicalRequest)))
|
stringToSign = stringToSign + hex.EncodeToString(sum256([]byte(canonicalRequest)))
|
||||||
|
|
||||||
date := sumHMAC([]byte("AWS4"+s.secretAccessKey), []byte(t.Format(yyyymmdd)))
|
date := sumHMAC([]byte("AWS4"+s.secretAccessKey), []byte(t.Format(yyyymmdd)))
|
||||||
region := sumHMAC(date, []byte("milkyway"))
|
region := sumHMAC(date, []byte("us-east-1"))
|
||||||
service := sumHMAC(region, []byte("s3"))
|
service := sumHMAC(region, []byte("s3"))
|
||||||
signingKey := sumHMAC(service, []byte("aws4_request"))
|
signingKey := sumHMAC(service, []byte("aws4_request"))
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user