if (!signed) {
WSSecSAMLToken wsSecSAMLToken = new WSSecSAMLToken();
if (samlVersion.equals(SAML_VERSION_1)) {
callbackHandler = new SAML1CallbackHandler(assertionType, confirmationMethod);
} else if (samlVersion.equals(SAML_VERSION_2)) {
callbackHandler = new SAML2CallbackHandler(assertionType, confirmationMethod);
} else {
throw new IllegalArgumentException(NOT_A_VALID_SAML_VERSION);
}
AssertionWrapper assertion = createAssertion(context, samlParms, callbackHandler);
wsSecSAMLToken.build(doc, assertion, secHeader);
} else {
WSSecSignatureSAML wsSecSignatureSAML = new WSSecSignatureSAML();
WssCrypto wssCrypto = getWssContainer().getCryptoByName(crypto, true);
String alias = context.expand(getUsername());
if (wssCrypto == null) {
throw new RuntimeException("Missing keystore [" + crypto + "] for signature entry");
} else if (Strings.isNullOrEmpty(alias)) {
throw new RuntimeException(" No alias was provided for the keystore '" + crypto + "'. Please check your SAML (Form) configurations");
}
if (samlVersion.equals(SAML_VERSION_1)) {
callbackHandler = new SAML1CallbackHandler(wssCrypto.getCrypto(), alias,
assertionType, confirmationMethod);
} else if (samlVersion.equals(SAML_VERSION_2)) {
callbackHandler = new SAML2CallbackHandler(wssCrypto.getCrypto(), alias,
assertionType, confirmationMethod);
} else {