use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class STSTokenOutInterceptorTest method initStsClientTransportBinding.
private STSClient initStsClientTransportBinding(Bus bus) {
bus.getInInterceptors().add(new LoggingOutInterceptor());
bus.getOutInterceptors().add(new LoggingInInterceptor());
bus.getOutFaultInterceptors().add(new LoggingInInterceptor());
STSClient stsClient = new STSClient(bus);
stsClient.setWsdlLocation("https://localhost:" + STSPORT + STS_TRANSPORT_WSDL_LOCATION_RELATIVE);
stsClient.setServiceName(STS_SERVICE_NAME);
stsClient.setEndpointName(STS_TRANSPORT_ENDPOINT_NAME);
stsClient.setTokenType(TOKEN_TYPE_SAML_2_0);
stsClient.setAllowRenewingAfterExpiry(true);
stsClient.setEnableLifetime(true);
Map<String, Object> props = new HashMap<>();
props.put(SecurityConstants.USERNAME, "alice");
props.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
stsClient.setProperties(props);
return stsClient;
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class STSTokenRetrieverTest method initStsClientTransportBinding.
private STSClient initStsClientTransportBinding(Bus bus) {
bus.getInInterceptors().add(new LoggingOutInterceptor());
bus.getOutInterceptors().add(new LoggingInInterceptor());
bus.getOutFaultInterceptors().add(new LoggingInInterceptor());
STSClient stsClient = new STSClient(bus);
stsClient.setWsdlLocation("https://localhost:" + STSPORT + STS_TRANSPORT_WSDL_LOCATION_RELATIVE);
stsClient.setServiceName(STS_SERVICE_NAME);
stsClient.setEndpointName(STS_TRANSPORT_ENDPOINT_NAME);
stsClient.setTokenType(TOKEN_TYPE_SAML_2_0);
stsClient.setAllowRenewingAfterExpiry(true);
stsClient.setEnableLifetime(true);
Map<String, Object> props = new HashMap<>();
props.put(SecurityConstants.USERNAME, "alice");
props.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
stsClient.setProperties(props);
return stsClient;
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class STSTokenRetrieverTest method initStsClientAsymmeticBinding.
private STSClient initStsClientAsymmeticBinding(Bus bus) {
bus.getInInterceptors().add(new LoggingOutInterceptor());
bus.getOutInterceptors().add(new LoggingInInterceptor());
bus.getOutFaultInterceptors().add(new LoggingInInterceptor());
STSClient stsClient = new STSClient(bus);
stsClient.setWsdlLocation("http://localhost:" + STSPORT2 + STS_X509_WSDL_LOCATION_RELATIVE);
stsClient.setServiceName(STS_SERVICE_NAME);
stsClient.setEndpointName(STS_X509_ENDPOINT_NAME);
stsClient.setTokenType(TOKEN_TYPE_SAML_2_0);
stsClient.setKeyType(KEY_TYPE_X509);
stsClient.setAllowRenewingAfterExpiry(true);
stsClient.setEnableLifetime(true);
Map<String, Object> props = new HashMap<>();
props.put(SecurityConstants.CALLBACK_HANDLER, "org.apache.cxf.systest.sts.common.CommonCallbackHandler");
props.put(SecurityConstants.ENCRYPT_USERNAME, "mystskey");
props.put(SecurityConstants.ENCRYPT_PROPERTIES, "clientKeystore.properties");
props.put(SecurityConstants.SIGNATURE_PROPERTIES, "clientKeystore.properties");
props.put(SecurityConstants.STS_TOKEN_USERNAME, "mystskey");
props.put(SecurityConstants.STS_TOKEN_PROPERTIES, "clientKeystore.properties");
props.put(SecurityConstants.STS_TOKEN_USE_CERT_FOR_KEYINFO, "true");
stsClient.setProperties(props);
return stsClient;
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class BookServer method run.
protected void run() {
Bus bus = BusFactory.getDefaultBus();
bus.setProperty(ExceptionMapper.class.getName(), new BusMapperExceptionMapper());
setBus(bus);
JAXRSServerFactoryBean sf = new JAXRSServerFactoryBean();
sf.setBus(bus);
sf.setResourceClasses(BookStore.class, SimpleBookStore.class, BookStorePerRequest.class);
List<Object> providers = new ArrayList<>();
// default lifecycle is per-request, change it to singleton
BinaryDataProvider<Object> p = new BinaryDataProvider<Object>();
p.setProduceMediaTypes(Collections.singletonList("application/bar"));
p.setEnableBuffering(true);
p.setReportByteArraySize(true);
providers.add(p);
providers.add(new BookStore.PrimitiveIntArrayReaderWriter());
providers.add(new BookStore.PrimitiveDoubleArrayReaderWriter());
providers.add(new BookStore.StringArrayBodyReaderWriter());
providers.add(new BookStore.StringListBodyReaderWriter());
providers.add(new StreamingResponseProvider<Object>());
providers.add(new ContentTypeModifyingMBW());
JAXBElementProvider<?> jaxbProvider = new JAXBElementProvider<Object>();
Map<String, String> jaxbElementClassMap = new HashMap<>();
jaxbElementClassMap.put(BookNoXmlRootElement.class.getName(), "BookNoXmlRootElement");
jaxbProvider.setJaxbElementClassMap(jaxbElementClassMap);
providers.add(jaxbProvider);
providers.add(new FormatResponseHandler());
providers.add(new GenericHandlerWriter());
providers.add(new FaultyRequestHandler());
providers.add(new SearchContextProvider());
providers.add(new QueryContextProvider());
providers.add(new BlockingRequestFilter());
providers.add(new FaultyResponseFilter());
providers.add(new BlockedExceptionMapper());
providers.add(new ParamConverterImpl());
sf.setProviders(providers);
List<Interceptor<? extends Message>> inInts = new ArrayList<Interceptor<? extends Message>>();
inInts.add(new CustomInFaultyInterceptor());
inInts.add(new LoggingInInterceptor());
sf.setInInterceptors(inInts);
List<Interceptor<? extends Message>> outInts = new ArrayList<Interceptor<? extends Message>>();
outInts.add(new CustomOutInterceptor());
outInts.add(new LoggingOutInterceptor());
sf.setOutInterceptors(outInts);
List<Interceptor<? extends Message>> outFaultInts = new ArrayList<Interceptor<? extends Message>>();
outFaultInts.add(new CustomOutFaultInterceptor());
sf.setOutFaultInterceptors(outFaultInts);
sf.setResourceProvider(BookStore.class, new SingletonResourceProvider(new BookStore(), true));
sf.setAddress("http://localhost:" + PORT + "/");
sf.getProperties(true).put("org.apache.cxf.jaxrs.mediaTypeCheck.strict", true);
sf.getProperties().put("search.visitor", new SQLPrinterVisitor<SearchBean>("books"));
sf.getProperties().put("org.apache.cxf.http.header.split", true);
sf.getProperties().put("default.content.type", "*/*");
sf.getProperties().putAll(properties);
server = sf.create();
BusFactory.setDefaultBus(null);
BusFactory.setThreadDefaultBus(null);
}
use of org.apache.cxf.ext.logging.LoggingInInterceptor in project cxf by apache.
the class HTraceTracingTest method createJaxWsService.
private BookStoreService createJaxWsService(final Map<String, List<String>> headers, final Configurator configurator) throws MalformedURLException {
JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.getOutInterceptors().add(new LoggingOutInterceptor());
factory.getInInterceptors().add(new LoggingInInterceptor());
factory.setServiceClass(BookStoreService.class);
factory.setAddress("http://localhost:" + PORT + "/BookStore");
if (configurator != null) {
configurator.configure(factory);
}
final BookStoreService service = (BookStoreService) factory.create();
final Client proxy = ClientProxy.getClient(service);
proxy.getRequestContext().put(Message.PROTOCOL_HEADERS, headers);
return service;
}
Aggregations