use of org.opensaml.soap.client.http.PipelineFactoryHttpSOAPClient in project pac4j by pac4j.
the class SAML2ArtifactBindingDecoder method doDecode.
@Override
protected void doDecode() throws MessageDecodingException {
try {
final var endpointResolver = new DefaultEndpointResolver<ArtifactResolutionService>();
endpointResolver.initialize();
final var roleResolver = new PredicateRoleDescriptorResolver(idpMetadataResolver.resolve());
roleResolver.initialize();
final var messageContext = new SAML2MessageContext();
final var soapClient = new PipelineFactoryHttpSOAPClient() {
@SuppressWarnings("rawtypes")
@Override
public void send(final String endpoint, final InOutOperationContext operationContext) throws SOAPException, SecurityException {
super.send(endpoint, operationContext);
transferContext(operationContext, messageContext);
}
};
soapClient.setPipelineFactory(soapPipelineProvider.getPipelineFactory());
soapClient.setHttpClient(soapPipelineProvider.getHttpClientBuilder().buildClient());
final var artifactDecoder = new Pac4jHTTPArtifactDecoder();
artifactDecoder.setWebContext(context);
artifactDecoder.setSelfEntityIDResolver(new FixedEntityIdResolver(spMetadataResolver));
artifactDecoder.setRoleDescriptorResolver(roleResolver);
artifactDecoder.setArtifactEndpointResolver(endpointResolver);
artifactDecoder.setPeerEntityRole(IDPSSODescriptor.DEFAULT_ELEMENT_NAME);
artifactDecoder.setSOAPClient(soapClient);
artifactDecoder.setParserPool(getParserPool());
artifactDecoder.initialize();
artifactDecoder.decode();
messageContext.getMessageContext().setMessage(artifactDecoder.getMessageContext().getMessage());
this.populateBindingContext(messageContext);
this.setMessageContext(messageContext.getMessageContext());
} catch (final Exception e) {
throw new MessageDecodingException(e);
}
}
Aggregations