Skip to content

Commit 84b0e9e

Browse files
committed
utils: add missing string to the url in generate saml signature method
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
1 parent 5a0ed87 commit 84b0e9e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

utils/src/org/apache/cloudstack/utils/auth/SAMLUtils.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,14 +218,14 @@ public static Response decodeSAMLResponse(String responseMessage)
218218

219219
public static String generateSAMLRequestSignature(String urlEncodedString, PrivateKey signingKey)
220220
throws NoSuchAlgorithmException, SignatureException, InvalidKeyException, UnsupportedEncodingException {
221-
if (signingKey == null || urlEncodedString == null) {
222-
return null;
221+
if (signingKey == null) {
222+
return urlEncodedString;
223223
}
224224
String url = urlEncodedString + "&SigAlg=" + URLEncoder.encode(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1, HttpUtils.UTF_8);
225225
Signature signature = Signature.getInstance("SHA1withRSA");
226226
signature.initSign(signingKey);
227227
signature.update(url.getBytes());
228-
return URLEncoder.encode(Base64.encodeBytes(signature.sign(), Base64.DONT_BREAK_LINES), HttpUtils.UTF_8);
228+
return url + "&Signature=" + URLEncoder.encode(Base64.encodeBytes(signature.sign(), Base64.DONT_BREAK_LINES), HttpUtils.UTF_8);
229229
}
230230

231231
public static KeyFactory getKeyFactory() {

0 commit comments

Comments
 (0)