public class SAMLTokenSignedAction implements Action {
private static Log log = LogFactory.getLog(SAMLTokenSignedAction.class.getName());
public void execute(WSHandler handler, int actionToDo, Document doc, RequestData reqData)
throws WSSecurityException {
Crypto crypto = null;
/*
* it is possible and legal that we do not have a signature
* crypto here - thus ignore the exception. This is usually
* the case for the SAML option "sender vouches". In this case
* no user crypto is required.
*/
try {
crypto = handler.loadSignatureCrypto(reqData);
} catch (Throwable t){
}
SAMLIssuer saml = loadSamlIssuer(handler, reqData);
saml.setUsername(reqData.getUsername());
saml.setUserCrypto(crypto);
saml.setInstanceDoc(doc);
SAMLAssertion assertion = saml.newAssertion();
if (assertion == null) {
throw new WSSecurityException("WSHandler: Signed SAML: no SAML token received");
}
String issuerKeyName = null;
String issuerKeyPW = null;
Crypto issuerCrypto = null;
WSSecSignatureSAML wsSign = new WSSecSignatureSAML();
wsSign.setWsConfig(reqData.getWssConfig());
String password = null;