private WebClient getAccessTokenService() {
   final JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
   bean.setAddress(oauth2TokenServiceURI.toASCIIString());
   bean.setUsername("odatajclient");
   bean.setPassword("odatajclient");
   return bean.createWebClient()
       .type(MediaType.APPLICATION_FORM_URLENCODED_TYPE)
       .accept(MediaType.APPLICATION_JSON_TYPE);
 }
예제 #2
0
파일: ClientImpl.java 프로젝트: Jutten/cxf
 private void initTargetClientIfNeeded() {
   URI uri = uriBuilder.build();
   if (targetClient == null) {
     JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
     bean.setAddress(uri.toString());
     targetClient = bean.createWebClient();
     ClientImpl.this.baseClients.add(targetClient);
   } else if (!targetClient.getCurrentURI().equals(uri)) {
     targetClient.to(uri.toString(), false);
   }
 }
예제 #3
0
 @Scope(value = SCOPE_PROTOTYPE)
 public WebClient baseWebClient() {
   JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
   bean.setAddress(env.getRequiredProperty("nflow.url"));
   bean.getFeatures().add(new LoggingFeature());
   bean.setProviders(asList(jsonProvider));
   bean.setBus(cxf());
   return bean.createWebClient()
       .type(APPLICATION_JSON)
       .accept(APPLICATION_JSON)
       .path("api")
       .path("v1");
 }
  private WebClient createWebClient(String address, Map<String, Object> extraProperties) {
    JAXRSClientFactoryBean bean = new JAXRSClientFactoryBean();
    bean.setAddress(address);

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = JAXRSSamlAuthorizationTest.class.getResource("client.xml");
    Bus springBus = bf.createBus(busFile.toString());
    bean.setBus(springBus);

    Map<String, Object> properties = new HashMap<String, Object>();
    properties.put(
        "security.saml-callback-handler",
        "org.apache.cxf.systest.jaxrs.security.saml.SamlCallbackHandler");
    if (extraProperties != null) {
      properties.putAll(extraProperties);
    }
    bean.setProperties(properties);

    bean.getOutInterceptors().add(new SamlEnvelopedOutInterceptor());

    return bean.createWebClient();
  }