use of org.apache.cxf.interceptor.LoggingOutInterceptor in project midpoint by Evolveum.
the class Action method createModelPort.
protected ModelPortType createModelPort() {
ModelService modelService = new ModelService();
ModelPortType port = modelService.getModelPort();
BindingProvider bp = (BindingProvider) port;
Client client = ClientProxy.getClient(port);
Endpoint endpoint = client.getEndpoint();
HTTPConduit http = (HTTPConduit) client.getConduit();
HTTPClientPolicy httpClientPolicy = http.getClient();
if (httpClientPolicy == null) {
httpClientPolicy = new HTTPClientPolicy();
http.setClient(httpClientPolicy);
}
httpClientPolicy.setConnectionTimeout(10000);
Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, params.getUrl().toString());
requestContext.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
requestContext.put(WSHandlerConstants.USER, params.getUsername());
requestContext.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
ClientPasswordHandler handler = new ClientPasswordHandler();
handler.setPassword(params.getInsertedPassword());
requestContext.put(WSHandlerConstants.PW_CALLBACK_REF, handler);
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(requestContext);
endpoint.getOutInterceptors().add(wssOut);
if (params.isVerbose()) {
endpoint.getOutInterceptors().add(new LoggingOutInterceptor());
endpoint.getInInterceptors().add(new LoggingInInterceptor());
}
return port;
}
use of org.apache.cxf.interceptor.LoggingOutInterceptor in project opennms by OpenNMS.
the class TsrmTicketerPlugin method getService.
private SHSIMPINCPortType getService() {
final SHSIMPINC service = new SHSIMPINC();
port = service.getSHSIMPINCSOAP12Port();
final Client cxfClient = ClientProxy.getClient(port);
try {
cxfClient.getRequestContext().put(Message.ENDPOINT_ADDRESS, getProperties().getProperty("tsrm.url"));
final HTTPConduit http = (HTTPConduit) cxfClient.getConduit();
String stictSSL = getProperties().getProperty("tsrm.ssl.strict");
if (!Boolean.parseBoolean(stictSSL)) {
LOG.debug("Disabling strict SSL checking.");
// Accept all certificates
final TrustManager[] simpleTrustManager = new TrustManager[] { new AnyServerX509TrustManager() };
final TLSClientParameters tlsParams = new TLSClientParameters();
tlsParams.setTrustManagers(simpleTrustManager);
tlsParams.setDisableCNCheck(true);
http.setTlsClientParameters(tlsParams);
}
} catch (IOException e) {
LOG.error("Unable to load tsrm properties ", e);
}
// Log incoming and outgoing requests
LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
loggingInInterceptor.setPrettyLogging(true);
cxfClient.getInInterceptors().add(loggingInInterceptor);
LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
loggingOutInterceptor.setPrettyLogging(true);
cxfClient.getOutInterceptors().add(loggingOutInterceptor);
return port;
}
use of org.apache.cxf.interceptor.LoggingOutInterceptor in project OpenAM by OpenRock.
the class SoapSTSConsumer method getSTSClient.
private STSClient getSTSClient(String wsdlAddress, QName serviceQName, QName portQName) throws SoapSTSConsumerException {
STSClient stsClient = new STSClient(bus);
if (logMessages) {
stsClient.getInInterceptors().add(new LoggingInInterceptor());
stsClient.getOutInterceptors().add(new LoggingOutInterceptor());
}
stsClient.setWsdlLocation(wsdlAddress);
stsClient.setServiceName(serviceQName.toString());
stsClient.setEndpointName(portQName.toString());
Map<String, Object> properties = new HashMap<>();
properties.put(SecurityConstants.USERNAME, usernameTokenSupportingTokenUsername);
properties.put(SecurityConstants.CALLBACK_HANDLER, callbackHander);
/*
In a asymmetric binding, the client encrypt messages with with the sts' public key.
Note that this trust (Public Key) keystore entry is not protected by a password, so the SoapSTSConsumerCallbackHandler is
not asked to provide the password corresponding to this entry.
*/
properties.put(SecurityConstants.ENCRYPT_USERNAME, stsPublicKeyAlias);
Crypto crypto;
try {
crypto = CryptoFactory.getInstance(getEncryptionProperties());
} catch (WSSecurityException e) {
throw new SoapSTSConsumerException(e.getMessage(), e);
}
/*
if the requested key is Public the STS_TOKEN_CRYPTO is used by the STSClient 'to send/process any
RSA/DSAKeyValue tokens' - from javadocs
*/
properties.put(SecurityConstants.STS_TOKEN_CRYPTO, crypto);
properties.put(SecurityConstants.ENCRYPT_CRYPTO, crypto);
properties.put(SecurityConstants.SIGNATURE_CRYPTO, crypto);
stsClient.setProperties(properties);
return stsClient;
}
use of org.apache.cxf.interceptor.LoggingOutInterceptor in project Activiti by Activiti.
the class AbstractWebServiceTaskTest method initializeProcessEngine.
@Override
protected void initializeProcessEngine() {
super.initializeProcessEngine();
webServiceMock = new WebServiceMockImpl();
JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
svrFactory.setServiceClass(WebServiceMock.class);
svrFactory.setAddress("http://localhost:63081/webservicemock");
svrFactory.setServiceBean(webServiceMock);
svrFactory.getInInterceptors().add(new LoggingInInterceptor());
svrFactory.getOutInterceptors().add(new LoggingOutInterceptor());
server = svrFactory.create();
server.start();
}
use of org.apache.cxf.interceptor.LoggingOutInterceptor in project midpoint by Evolveum.
the class Main method createModelPort.
public static ModelPortType createModelPort(String[] args) {
String endpointUrl = DEFAULT_ENDPOINT_URL;
if (args.length > 0) {
endpointUrl = args[0];
}
System.out.println("Endpoint URL: " + endpointUrl);
// uncomment this if you want to use Fiddler or any other proxy
//ProxySelector.setDefault(new MyProxySelector("127.0.0.1", 8888));
ModelService modelService = new ModelService();
ModelPortType modelPort = modelService.getModelPort();
BindingProvider bp = (BindingProvider) modelPort;
Map<String, Object> requestContext = bp.getRequestContext();
requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
org.apache.cxf.endpoint.Client client = ClientProxy.getClient(modelPort);
org.apache.cxf.endpoint.Endpoint cxfEndpoint = client.getEndpoint();
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, ADM_USERNAME);
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_DIGEST);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordHandler.class.getName());
WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);
cxfEndpoint.getOutInterceptors().add(wssOut);
// enable the following to get client-side logging of outgoing requests and incoming responses
cxfEndpoint.getOutInterceptors().add(new LoggingOutInterceptor());
cxfEndpoint.getInInterceptors().add(new LoggingInInterceptor());
return modelPort;
}
Aggregations