protected void cleanup() { restClientFactory.getHeaders().remove(HttpHeaders.AUTHORIZATION); restClientFactory.setUsername(null); restClientFactory.setPassword(null); }
protected void cleanup() { restClientFactory.getHeaders().remove(HttpHeaders.AUTHORIZATION); restClientFactory.setUsername(null); restClientFactory.setPassword(null); }
private static JAXRSClientFactoryBean cleanFactory(JAXRSClientFactoryBean bean) { bean.setUsername(null); bean.setPassword(null); bean.setFeatures(Arrays.<AbstractFeature> asList()); return bean; }
private static JAXRSClientFactoryBean cleanFactory(JAXRSClientFactoryBean bean) { bean.setUsername(null); bean.setPassword(null); bean.setInitialState(null); bean.setFeatures(Arrays.<AbstractFeature>asList()); return bean; }
/** * Creates WebClient which will do basic authentication * @param baseAddress baseAddress * @param username username * @param password password * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); bean.setUsername(username); bean.setPassword(password); return bean.createWebClient(); }
/** * Creates WebClient which will do basic authentication * @param baseAddress baseAddress * @param username username * @param password password * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); bean.setUsername(username); bean.setPassword(password); return bean.createWebClient(); }
/** * Creates a proxy which will do basic authentication * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param username username * @param password password * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setUsername(username); bean.setPassword(password); return bean.create(cls); }
/** * Creates a proxy which will do basic authentication * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param username username * @param password password * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setUsername(username); bean.setPassword(password); return bean.create(cls); }
/** * Creates WebClient which will do basic authentication * @param baseAddress baseAddress * @param username username * @param password password * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); bean.setUsername(username); bean.setPassword(password); return bean.createWebClient(); }
/** * Creates a proxy which will do basic authentication * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param username username * @param password password * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setUsername(username); bean.setPassword(password); return bean.create(cls); }
/** * Creates WebClient which will do basic authentication * @param baseAddress baseAddress * @param providers list of providers * @param username username * @param password password * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, List<?> providers, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); bean.setUsername(username); bean.setPassword(password); bean.setProviders(providers); return bean.createWebClient(); }
/** * Creates WebClient which will do basic authentication * @param baseAddress baseAddress * @param providers list of providers * @param username username * @param password password * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, List<?> providers, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); bean.setUsername(username); bean.setPassword(password); bean.setProviders(providers); return bean.createWebClient(); }
/** * Creates a proxy which will do basic authentication * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param username username * @param password password * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setUsername(username); bean.setPassword(password); bean.setProviders(providers); return bean.create(cls); }
private WebClient createClient(String address, String userName, String password) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); bean.setUsername(userName); bean.setPassword(password); bean.getOutInterceptors().add(new LoggingOutInterceptor()); bean.getInInterceptors().add(new LoggingInInterceptor()); return bean.createWebClient(); }
/** * Creates a proxy which will do basic authentication * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param username username * @param password password * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setUsername(username); bean.setPassword(password); bean.setProviders(providers); return bean.create(cls); }
/** * Creates WebClient which will do basic authentication * @param baseAddress baseAddress * @param providers list of providers * @param username username * @param password password * @param configLocation classpath location of the configuration resource, can be null * @return WebClient instance */ public static WebClient create(String baseAddress, List<?> providers, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, configLocation); bean.setUsername(username); bean.setPassword(password); bean.setProviders(providers); return bean.createWebClient(); }
/** * Creates a proxy which will do basic authentication * @param baseAddress baseAddress * @param cls proxy class, if not interface then a CGLIB proxy will be created * @param providers list of providers * @param username username * @param password password * @param configLocation classpath location of the configuration resource * @return typed proxy */ public static <T> T create(String baseAddress, Class<T> cls, List<?> providers, String username, String password, String configLocation) { JAXRSClientFactoryBean bean = getBean(baseAddress, cls, configLocation); bean.setUsername(username); bean.setPassword(password); bean.setProviders(providers); return bean.create(cls); }
private WebClient createClient(String address, String username, String password) { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress(address); bean.setUsername(username); bean.setPassword(password); bean.getOutInterceptors().add(new LoggingOutInterceptor()); bean.getInInterceptors().add(new LoggingInInterceptor()); WebClient wc = bean.createWebClient(); WebClient.getConfig(wc).getHttpConduit().getClient().setReceiveTimeout(1000000L); return wc; }
protected JAXRSClientFactoryBean getClientFactory() { if (null == cachedClientFactory) { JAXRSClientFactoryBean factoryBean = new JAXRSClientFactoryBean(); factoryBean.setThreadSafe(true); factoryBean.setAddress(getServerURL()); if (Authentication.BASIC == auxiliaryStorageAuthentication) { factoryBean.setUsername(authenticationUser); factoryBean.setPassword(authenticationPassword); } if (Authentication.SAML == auxiliaryStorageAuthentication) { STSClient stsClient = STSClientCreator.create(factoryBean.getBus(), stsProps); STSRESTOutInterceptor outInterceptor = new STSRESTOutInterceptor(); outInterceptor.setStsClient(stsClient); factoryBean.getOutInterceptors().add(outInterceptor); factoryBean.getOutInterceptors().add(new SamlHeaderOutInterceptor()); } cachedClientFactory = factoryBean; } return cachedClientFactory; }
@Test public void testGetBook123UserModelAuthorize() throws Exception { JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean(); bean.setAddress("http://localhost:" + PORT + "/usermodel/bookstore/books"); bean.setUsername("Barry"); bean.setPassword("password"); bean.setModelRef("classpath:org/apache/cxf/systest/jaxrs/resources/resources.xml"); WebClient proxy = bean.createWebClient(); proxy.path("{id}/authorize", 123); Book book = proxy.get(Book.class); assertEquals(123L, book.getId()); }