--
You received this message because you are subscribed to the Google Groups "ipf-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ipf-user+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ipf-user/993f0b38-9394-4702-b245-360169e78d70n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ipf-user/8ccc0918-6bc3-43e7-938b-5668c0d7bf60n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ipf-user/52636e89-5aaf-45b0-9f09-204f1d1edb3en%40googlegroups.com.
I have to admit, that I still don't see the way forward on how to add the required signature now.What am I missing here? I've started reading the docs, but it seems as if Husky does not provide
some straight forward way to sign the desired element of the header and add the signature to it, does it?
List<SoapHeader> soapHeaders = CastUtils.cast((List<?>) exchange.getIn().getHeader(AbstractWsEndpoint.OUTGOING_SOAP_HEADERS));
if (soapHeaders == null) soapHeaders = new ArrayList<>();
final Document secDoc = XMLUtilities.createDocument();
final Element docElem = secDoc.createElementNS("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd", "Security");
docElem.setPrefix("wsse");
secDoc.appendChild(docElem);
final Element token = tokenStore.getToken(context.getAttributes());
if (token != null)
docElem.appendChild(secDoc.importNode(token, true));
final SoapHeader newHeader = new SoapHeader(new QName("soapHeader"), docElem);
newHeader.setDirection(Direction.DIRECTION_OUT);
soapHeaders.add(newHeader);
exchange.getIn().setHeader(AbstractWsEndpoint.OUTGOING_SOAP_HEADERS, soapHeaders);
Thanks Michael.How do you create the "tokenStore", then?
> I create it with opensamlAnd you are using this in an IPF project? Do you have example code on how you create it?
OpenSAMLUtil.initSamlEngine();
final Assertion assertion = SAML2ComponentBuilder.createAssertion();
// set all the necessary fields [...]
// set signature
final Signature signature = OpenSAMLUtil.buildSignature(); //(Signature)getSAMLBuilder().getBuilder(Signature.DEFAULT_ELEMENT_NAME).buildObject(Signature.DEFAULT_ELEMENT_NAME);
assertion.setSignature(signature);
final X509KeyInfoGeneratorFactory x509Factory = new X509KeyInfoGeneratorFactory();
x509Factory.setEmitEntityCertificate(true);
x509Factory.setEmitEntityCertificateChain(true);
final SignatureSigningParameters sigParams = new SignatureSigningParameters();
sigParams.setSignatureAlgorithm(SignatureConstants.ALGO_ID_SIGNATURE_RSA_SHA1);
sigParams.setSignatureCanonicalizationAlgorithm(SignatureConstants.ALGO_ID_C14N_EXCL_OMIT_COMMENTS);
sigParams.setSignatureReferenceDigestMethod(SignatureConstants.ALGO_ID_DIGEST_SHA1);
sigParams.setSigningCredential(signingCredential);
sigParams.setKeyInfoGenerator(x509Factory.newInstance());
signatureSupport.prepareSignatureParams(signature, sigParams);
return OpenSAMLUtil.toDom(assertion, null, true);