private WebClient createWebClient(String address,
Interceptor<Message> outInterceptor,
Object provider,
boolean selfSign) {
JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
bean.setAddress(address);
SpringBusFactory bf = new SpringBusFactory();
URL busFile = JAXRSSamlTest.class.getResource("client.xml");
Bus springBus = bf.createBus(busFile.toString());
bean.setBus(springBus);
Map<String, Object> properties = new HashMap<String, Object>();
properties.put("ws-security.callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.KeystorePasswordCallback");
properties.put("ws-security.saml-callback-handler",
"org.apache.cxf.systest.jaxrs.security.saml.SamlCallbackHandler");
properties.put("ws-security.signature.username", "alice");
properties.put("ws-security.signature.properties",
"org/apache/cxf/systest/jaxrs/security/alice.properties");
if (selfSign) {
properties.put("ws-security.self-sign-saml-assertion", "true");
}
bean.setProperties(properties);
bean.getOutInterceptors().add(outInterceptor);
if (provider != null) {
bean.setProvider(provider);
}
return bean.createWebClient();
}