7
0

delete sign value

This commit is contained in:
liangzy 2020-08-06 16:25:08 +08:00
parent 9c2898517e
commit 34c76f8901
2 changed files with 11 additions and 0 deletions

View File

@ -1,4 +1,12 @@
package auth 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 { type Credential interface {
} }

View File

@ -88,6 +88,8 @@ func unsignRpcRequest(request *http.Request, signer Signer) (err error) {
signValue, ok := signParams["sign"] signValue, ok := signParams["sign"]
if !ok { if !ok {
return errors.New("sign value is not exists") return errors.New("sign value is not exists")
} else {
delete(signParams, "sign")
} }
stringToSign := utils.GetUrlFormedMap(signParams) stringToSign := utils.GetUrlFormedMap(signParams)
@ -96,6 +98,7 @@ func unsignRpcRequest(request *http.Request, signer Signer) (err error) {
stringToSign = strings.Replace(stringToSign, "%7E", "~", -1) stringToSign = strings.Replace(stringToSign, "%7E", "~", -1)
stringToSign = url.QueryEscape(stringToSign) stringToSign = url.QueryEscape(stringToSign)
stringToSign = request.Method + "&%2F&" + stringToSign stringToSign = request.Method + "&%2F&" + stringToSign
debug("grsdk singstring %s", stringToSign)
if timestamp, err := strconv.ParseInt(signParams["access_time"], 10, 64); err != nil { if timestamp, err := strconv.ParseInt(signParams["access_time"], 10, 64); err != nil {
return err return err