forked from Mirrors/oauth2
update name change
This commit is contained in:
parent
88fab8941c
commit
8cdc6a9ad0
|
@ -26,20 +26,20 @@ type awsRequestSigner struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// AWS Signature Version 4 signing algorithm identifier.
|
// AWS Signature Version 4 signing algorithm identifier.
|
||||||
awsAlgorithm = "AWS4-HMAC-SHA256"
|
awsAlgorithm = "AWS4-HMAC-SHA256"
|
||||||
|
|
||||||
// The termination string for the AWS credential scope value as defined in
|
// The termination string for the AWS credential scope value as defined in
|
||||||
// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html
|
// https://docs.aws.amazon.com/general/latest/gr/sigv4-create-string-to-sign.html
|
||||||
awsRequestType = "aws4_request"
|
awsRequestType = "aws4_request"
|
||||||
|
|
||||||
// The AWS authorization header name for the security session token if available.
|
// The AWS authorization header name for the security session token if available.
|
||||||
awsSecurityTokenHeader = "x-amz-security-token"
|
awsSecurityTokenHeader = "x-amz-security-token"
|
||||||
|
|
||||||
// The AWS authorization header name for the auto-generated date.
|
// The AWS authorization header name for the auto-generated date.
|
||||||
awsDateHeader = "x-amz-date"
|
awsDateHeader = "x-amz-date"
|
||||||
|
|
||||||
awsTimeFormatLong = "20060102T150405Z"
|
awsTimeFormatLong = "20060102T150405Z"
|
||||||
awsTimeFormatShort = "20060102"
|
awsTimeFormatShort = "20060102"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -203,14 +203,14 @@ func (rs *awsRequestSigner) generateAuthentication(req *http.Request, timestamp
|
||||||
serviceName = splitHost[0]
|
serviceName = splitHost[0]
|
||||||
}
|
}
|
||||||
|
|
||||||
credentialScope := fmt.Sprintf("%s/%s/%s/%s", dateStamp, rs.RegionName, serviceName, awsRequestType)
|
credentialScope := fmt.Sprintf("%s/%s/%s/%s",dateStamp, rs.RegionName, serviceName, awsRequestType)
|
||||||
|
|
||||||
requestString, err := canonicalRequest(req, canonicalHeaderColumns, canonicalHeaderData)
|
requestString, err := canonicalRequest(req, canonicalHeaderColumns, canonicalHeaderData)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
requestHash, err := getSha256([]byte(requestString))
|
requestHash, err := getSha256([]byte(requestString))
|
||||||
if err != nil {
|
if err != nil{
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -221,7 +221,7 @@ func (rs *awsRequestSigner) generateAuthentication(req *http.Request, timestamp
|
||||||
dateStamp, rs.RegionName, serviceName, awsRequestType, stringToSign,
|
dateStamp, rs.RegionName, serviceName, awsRequestType, stringToSign,
|
||||||
} {
|
} {
|
||||||
signingKey, err = getHmacSha256(signingKey, []byte(signingInput))
|
signingKey, err = getHmacSha256(signingKey, []byte(signingInput))
|
||||||
if err != nil {
|
if err != nil{
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue