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