Support for Yandex Object Storage (#147)
* Update src/Network/Minio/Sign/V4.hs Co-authored-by: Sergey Ivanov <ivanovs-4@users.noreply.github.com
This commit is contained in:
parent
b9a3cfcd1d
commit
ae141fd6f5
@ -117,13 +117,15 @@ signV4 !sp !req =
|
|||||||
accessKey = toS $ spAccessKey sp
|
accessKey = toS $ spAccessKey sp
|
||||||
secretKey = toS $ spSecretKey sp
|
secretKey = toS $ spSecretKey sp
|
||||||
expiry = spExpirySecs sp
|
expiry = spExpirySecs sp
|
||||||
|
sha256Hdr = ("x-amz-content-sha256",
|
||||||
|
fromMaybe "UNSIGNED-PAYLOAD" $ spPayloadHash sp)
|
||||||
|
|
||||||
-- headers to be added to the request
|
-- headers to be added to the request
|
||||||
datePair = ("X-Amz-Date", awsTimeFormatBS ts)
|
datePair = ("X-Amz-Date", awsTimeFormatBS ts)
|
||||||
computedHeaders = NC.requestHeaders req ++
|
computedHeaders = NC.requestHeaders req ++
|
||||||
if isJust $ expiry
|
if isJust $ expiry
|
||||||
then []
|
then []
|
||||||
else [(\(x, y) -> (mk x, y)) datePair]
|
else map (\(x, y) -> (mk x, y)) [datePair, sha256Hdr]
|
||||||
headersToSign = getHeadersToSign computedHeaders
|
headersToSign = getHeadersToSign computedHeaders
|
||||||
signedHeaderKeys = B.intercalate ";" $ sort $ map fst headersToSign
|
signedHeaderKeys = B.intercalate ";" $ sort $ map fst headersToSign
|
||||||
|
|
||||||
@ -158,8 +160,6 @@ signV4 !sp !req =
|
|||||||
authHeader = mkAuthHeader (spAccessKey sp) scope signedHeaderKeys signature
|
authHeader = mkAuthHeader (spAccessKey sp) scope signedHeaderKeys signature
|
||||||
|
|
||||||
-- finally compute output pairs
|
-- finally compute output pairs
|
||||||
sha256Hdr = ("x-amz-content-sha256",
|
|
||||||
fromMaybe "UNSIGNED-PAYLOAD" $ spPayloadHash sp)
|
|
||||||
output = if isJust expiry
|
output = if isJust expiry
|
||||||
then ("X-Amz-Signature", signature) : authQP
|
then ("X-Amz-Signature", signature) : authQP
|
||||||
else [(\(x, y) -> (CI.foldedCase x, y)) authHeader,
|
else [(\(x, y) -> (CI.foldedCase x, y)) authHeader,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user