From 34c76f8901f8bd4c0000b1ff1ed42e5555095a25 Mon Sep 17 00:00:00 2001 From: liangzy Date: Thu, 6 Aug 2020 16:25:08 +0800 Subject: [PATCH] delete sign value --- sdk/auth/crediantial.go | 8 ++++++++ sdk/auth/rpc_signature_composer.go | 3 +++ 2 files changed, 11 insertions(+) diff --git a/sdk/auth/crediantial.go b/sdk/auth/crediantial.go index 29338e7..4fd6cbe 100644 --- a/sdk/auth/crediantial.go +++ b/sdk/auth/crediantial.go @@ -1,4 +1,12 @@ package auth +import "golib.gaore.com/GaoreGo/gaore-common-sdk-go/sdk/utils" + +var debug utils.Debug + +func init() { + debug = utils.Init("signer") +} + type Credential interface { } diff --git a/sdk/auth/rpc_signature_composer.go b/sdk/auth/rpc_signature_composer.go index c30619d..a57f079 100644 --- a/sdk/auth/rpc_signature_composer.go +++ b/sdk/auth/rpc_signature_composer.go @@ -88,6 +88,8 @@ func unsignRpcRequest(request *http.Request, signer Signer) (err error) { signValue, ok := signParams["sign"] if !ok { return errors.New("sign value is not exists") + } else { + delete(signParams, "sign") } stringToSign := utils.GetUrlFormedMap(signParams) @@ -96,6 +98,7 @@ func unsignRpcRequest(request *http.Request, signer Signer) (err error) { stringToSign = strings.Replace(stringToSign, "%7E", "~", -1) stringToSign = url.QueryEscape(stringToSign) stringToSign = request.Method + "&%2F&" + stringToSign + debug("grsdk singstring %s", stringToSign) if timestamp, err := strconv.ParseInt(signParams["access_time"], 10, 64); err != nil { return err