This is an automated email from the ASF dual-hosted git repository.
rohit pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudstack-cloudmonkey.git
The following commit(s) were added to refs/heads/main by this push:
new 1f45761 network: when using API key & secret key drop params (#150)
1f45761 is described below
commit 1f4576196fd09f0e5577ae01da3c93e148e4684c
Author: Rohit Yadav <[email protected]>
AuthorDate: Mon May 20 15:50:51 2024 +0530
network: when using API key & secret key drop params (#150)
Params need to be dropped as apikey & secretkey based URL has all the
params and it causes signature validation issues when the same params
are also posted again. For example, add host API with username, password
params.
Signed-off-by: Rohit Yadav <[email protected]>
---
cmd/network.go | 1 +
1 file changed, 1 insertion(+)
diff --git a/cmd/network.go b/cmd/network.go
index af97740..b5f4bef 100644
--- a/cmd/network.go
+++ b/cmd/network.go
@@ -221,6 +221,7 @@ func NewAPIRequest(r *Request, api string, args []string,
isAsync bool) (map[str
mac.Write([]byte(strings.ToLower(encodedParams)))
signature := base64.StdEncoding.EncodeToString(mac.Sum(nil))
encodedParams = encodedParams + fmt.Sprintf("&signature=%s",
url.QueryEscape(signature))
+ params = nil
} else if len(r.Config.ActiveProfile.Username) > 0 &&
len(r.Config.ActiveProfile.Password) > 0 {
sessionKey, err := Login(r)
if err != nil {