deflaterStream.finish();
byte[] deflatedMsg = baos.toByteArray();
String base64EncodedResponse = Base64.encodeBytes(deflatedMsg, Base64.DONT_BREAK_LINES);
PrivateKey privateKey = null;
if (signMessage) {
privateKey = samlEntityBean.get().getSigningKey().getPrivateKey();
}
sendSamlRedirect(base64EncodedResponse, signMessage, samlRequestOrResponse, privateKey, endpoint, response);
} else {
if (signMessage) {
PublicKey publicKey = samlEntityBean.get().getSigningKey().getCertificate().getPublicKey();
PrivateKey privateKey = samlEntityBean.get().getSigningKey().getPrivateKey();
signatureUtilForPostBinding.sign(message, new KeyPair(publicKey, privateKey));
}
byte[] messageBytes = SamlUtils.getDocumentAsString(message).getBytes("UTF-8");
String base64EncodedMessage = Base64.encodeBytes(messageBytes, Base64.DONT_BREAK_LINES);