SamlRedirectMessage samlRedirectMessage = new SamlRedirectMessage();
String base64EncodedMessage = Base64.encodeBytes("this is just a test string".getBytes(), Base64.DONT_BREAK_LINES);
samlRedirectMessage.setRequestOrResponse(SamlRequestOrResponse.REQUEST);
samlRedirectMessage.setSamlMessage(base64EncodedMessage);
samlRedirectMessage.setRelayState("foo");
samlRedirectMessage.encode();
try {
samlSignatureUtilForRedirectBinding.sign(samlRedirectMessage, keyPair.getPrivate());
} catch (IOException e) {
throw new RuntimeException(e);
} catch (GeneralSecurityException e) {