mirror of https://github.com/apache/cloudstack.git
volume upload: fixed issues during request validation
adding the encoded metadata to the signature
This commit is contained in:
parent
bc997f1acb
commit
b616894c21
|
|
@ -332,13 +332,13 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
|||
.getType().toString(), vol.getName(), vol.getFormat().toString(), dataObject.getDataStore().getUri(), dataObject.getDataStore().getRole().toString());
|
||||
command.setLocalPath(volumeStore.getLocalDownloadPath());
|
||||
Gson gson = new GsonBuilder().create();
|
||||
String jsonPayload = gson.toJson(command);
|
||||
response.setMetadata(EncryptionUtil.encodeData(jsonPayload, key));
|
||||
String metadata = EncryptionUtil.encodeData(gson.toJson(command), key);
|
||||
response.setMetadata(metadata);
|
||||
|
||||
/*
|
||||
* signature calculated on the url, expiry, metadata.
|
||||
*/
|
||||
response.setSignature(EncryptionUtil.generateSignature(jsonPayload + url + expires, key));
|
||||
response.setSignature(EncryptionUtil.generateSignature(metadata + url + expires, key));
|
||||
return response;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -374,13 +374,13 @@ public class TemplateManagerImpl extends ManagerBase implements TemplateManager,
|
|||
* encoded metadata using the post upload config ssh key
|
||||
*/
|
||||
Gson gson = new GsonBuilder().create();
|
||||
String jsonPayload = gson.toJson(firstCommand);
|
||||
response.setMetadata(EncryptionUtil.encodeData(jsonPayload, key));
|
||||
String metadata = EncryptionUtil.encodeData(gson.toJson(firstCommand), key);
|
||||
response.setMetadata(metadata);
|
||||
|
||||
/*
|
||||
* signature calculated on the url, expiry, metadata.
|
||||
*/
|
||||
response.setSignature(EncryptionUtil.generateSignature(jsonPayload + url + expires, key));
|
||||
response.setSignature(EncryptionUtil.generateSignature(metadata + url + expires, key));
|
||||
|
||||
return response;
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue