diff options
Diffstat (limited to 'weed/s3api/auth_signature_v4.go')
| -rw-r--r-- | weed/s3api/auth_signature_v4.go | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/weed/s3api/auth_signature_v4.go b/weed/s3api/auth_signature_v4.go index e7020e9ed..02a6bd4e0 100644 --- a/weed/s3api/auth_signature_v4.go +++ b/weed/s3api/auth_signature_v4.go @@ -198,9 +198,8 @@ func (c credentialHeader) getScope() string { }, "/") } -// Authorization: algorithm Credential=accessKeyID/credScope, \ -// SignedHeaders=signedHeaders, Signature=signature -// +// Authorization: algorithm Credential=accessKeyID/credScope, \ +// SignedHeaders=signedHeaders, Signature=signature func parseSignV4(v4Auth string) (sv signValues, aec s3err.ErrorCode) { // Replace all spaced strings, some clients can send spaced // parameters and some won't. So we pro-actively remove any spaces @@ -226,7 +225,7 @@ func parseSignV4(v4Auth string) (sv signValues, aec s3err.ErrorCode) { signV4Values := signValues{} var err s3err.ErrorCode - // Save credentail values. + // Save credential values. signV4Values.Credential, err = parseCredentialHeader(authFields[0]) if err != s3err.ErrNone { return sv, err @@ -310,7 +309,8 @@ func parseSignature(signElement string) (string, s3err.ErrorCode) { } // doesPolicySignatureMatch - Verify query headers with post policy -// - http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-HTTPPOSTConstructPolicy.html +// - http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-HTTPPOSTConstructPolicy.html +// // returns ErrNone if the signature matches. func (iam *IdentityAccessManagement) doesPolicySignatureV4Match(formValues http.Header) s3err.ErrorCode { @@ -341,7 +341,7 @@ func (iam *IdentityAccessManagement) doesPolicySignatureV4Match(formValues http. } // check query headers with presigned signature -// - http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html +// - http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html func (iam *IdentityAccessManagement) doesPresignedSignatureMatch(hashedPayload string, r *http.Request) (*Identity, s3err.ErrorCode) { // Copy request @@ -467,7 +467,7 @@ func contains(list []string, elem string) bool { return false } -// preSignValues data type represents structued form of AWS Signature V4 query string. +// preSignValues data type represents structured form of AWS Signature V4 query string. type preSignValues struct { signValues Date time.Time @@ -476,12 +476,12 @@ type preSignValues struct { // Parses signature version '4' query string of the following form. // -// querystring = X-Amz-Algorithm=algorithm -// querystring += &X-Amz-Credential= urlencode(accessKey + '/' + credential_scope) -// querystring += &X-Amz-Date=date -// querystring += &X-Amz-Expires=timeout interval -// querystring += &X-Amz-SignedHeaders=signed_headers -// querystring += &X-Amz-Signature=signature +// querystring = X-Amz-Algorithm=algorithm +// querystring += &X-Amz-Credential= urlencode(accessKey + '/' + credential_scope) +// querystring += &X-Amz-Date=date +// querystring += &X-Amz-Expires=timeout interval +// querystring += &X-Amz-SignedHeaders=signed_headers +// querystring += &X-Amz-Signature=signature // // verifies if any of the necessary query params are missing in the presigned request. func doesV4PresignParamsExist(query url.Values) s3err.ErrorCode { @@ -551,7 +551,7 @@ func parsePreSignV4(query url.Values) (psv preSignValues, aec s3err.ErrorCode) { return psv, err } - // Return structed form of signature query string. + // Return structured form of signature query string. return preSignV4Values, s3err.ErrNone } @@ -636,13 +636,13 @@ func getScope(t time.Time, region string) string { // getCanonicalRequest generate a canonical request of style // // canonicalRequest = -// <HTTPMethod>\n -// <CanonicalURI>\n -// <CanonicalQueryString>\n -// <CanonicalHeaders>\n -// <SignedHeaders>\n -// <HashedPayload> // +// <HTTPMethod>\n +// <CanonicalURI>\n +// <CanonicalQueryString>\n +// <CanonicalHeaders>\n +// <SignedHeaders>\n +// <HashedPayload> func getCanonicalRequest(extractedSignedHeaders http.Header, payload, queryStr, urlPath, method string) string { rawQuery := strings.Replace(queryStr, "+", "%20", -1) encodedPath := encodePath(urlPath) |
