當前位置: 首頁>>代碼示例>>Java>>正文


Java HTTPConduit.setAuthorization方法代碼示例

本文整理匯總了Java中org.apache.cxf.transport.http.HTTPConduit.setAuthorization方法的典型用法代碼示例。如果您正苦於以下問題:Java HTTPConduit.setAuthorization方法的具體用法?Java HTTPConduit.setAuthorization怎麽用?Java HTTPConduit.setAuthorization使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.cxf.transport.http.HTTPConduit的用法示例。


在下文中一共展示了HTTPConduit.setAuthorization方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setClientAuthentication

import org.apache.cxf.transport.http.HTTPConduit; //導入方法依賴的package包/類
private static void setClientAuthentication(Object client, String userName, String password) {
	// Properties p = new Properties(); //PropertiesLoader.getPropertiesFromFile("config.properties");
	ClientConfiguration config = WebClient.getConfig(client);
	HTTPConduit httpConduit = (HTTPConduit) config.getConduit();

	AuthorizationPolicy authorization = new AuthorizationPolicy();
	authorization.setUserName(userName);
	authorization.setPassword(password);
	httpConduit.setAuthorization(authorization);

	TLSClientParameters tlsParams = new TLSClientParameters();
	TrustManager[] trustAllCerts = new TrustManager[] { new TrustManager() };
	tlsParams.setTrustManagers(trustAllCerts);

	// disables verification of the common name (the host for which the certificate has been issued)
	tlsParams.setDisableCNCheck(true);
	httpConduit.setTlsClientParameters(tlsParams);
}
 
開發者ID:williamgrosset,項目名稱:OSCAR-ConCert,代碼行數:19,代碼來源:EaapsServiceClient.java

示例2: ticketAgentConduit

import org.apache.cxf.transport.http.HTTPConduit; //導入方法依賴的package包/類
@Bean
public HTTPConduit ticketAgentConduit() {
  HTTPConduit httpConduit =
      (HTTPConduit) ticketAgentClientProxy().getConduit();
  httpConduit.setAuthorization(basicAuthorization());

  return httpConduit;
}
 
開發者ID:code-not-found,項目名稱:cxf-jaxws,代碼行數:9,代碼來源:ClientConfig.java

示例3: setBasicAuthentication

import org.apache.cxf.transport.http.HTTPConduit; //導入方法依賴的package包/類
private void setBasicAuthentication(String userName, String password) {
    Client client = ClientProxy.getClient(helloWorldJaxWsProxy);
    HTTPConduit conduit = (HTTPConduit) client.getConduit();

    AuthorizationPolicy authorizationPolicy = new AuthorizationPolicy();
    authorizationPolicy.setUserName(userName);
    authorizationPolicy.setPassword(password);

    conduit.setAuthorization(authorizationPolicy);
}
 
開發者ID:code-not-found,項目名稱:jaxws-cxf,代碼行數:11,代碼來源:HelloWorldClientImpl.java

示例4: proxyFor

import org.apache.cxf.transport.http.HTTPConduit; //導入方法依賴的package包/類
/**
 * Creates a proxy for the given interface without
 * @param <T> The type bound to the service interface
 * @param serviceInterface The service interface
 * @return The proxy for the given interface
 */
@SuppressWarnings("unchecked")
public synchronized <T> T proxyFor(final Class<T> serviceInterface) {
    // Check for a cached instance
    final Object cached = cachedProxies.get(serviceInterface);
    if (cached != null) {
        return (T) cached;
    }
    // Cache miss. Create the proxy
    final String url = resolveUrlFor(serviceInterface);
    if (url == null) {
        throw new IllegalStateException("Cannot resolve url for service " + serviceInterface.getName() + " for server root url " + serverRootUrl);
    }

    // Create a proxy factory
    final JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(serviceInterface);
    factory.setAddress(url);

    // Create the proxy
    final Object proxy = factory.create();

    final Client client = ClientProxy.getClient(proxy);
    final HTTPConduit http = (HTTPConduit) client.getConduit();

    // If the username / password are set, use them
    if (username != null || password != null) {
        final AuthorizationPolicy authorization = new AuthorizationPolicy();
        authorization.setUserName(username);
        authorization.setPassword(password);

        http.setAuthorization(authorization);
        http.setAuthSupplier(new DefaultBasicAuthSupplier());
    }

    http.setTlsClientParameters(getTLSClientParameters());
    http.getClient().setConnectionTimeout(connectionTimeout);
    http.getClient().setReceiveTimeout(readTimeout);

    // The proxy is ready. Store it on the cache
    cachedProxies.put(serviceInterface, proxy);

    return (T) proxy;
}
 
開發者ID:mateli,項目名稱:OpenCyclos,代碼行數:50,代碼來源:CyclosWebServicesClientFactory.java

示例5: setupAuth

import org.apache.cxf.transport.http.HTTPConduit; //導入方法依賴的package包/類
@Override
public void setupAuth(Client client) {
    HTTPConduit httpConduit = (HTTPConduit) client.getConduit();
    httpConduit.setAuthorization(auth);
}
 
開發者ID:apifocal,項目名稱:wsman4j,代碼行數:6,代碼來源:HttpBasicAuthenticator.java


注:本文中的org.apache.cxf.transport.http.HTTPConduit.setAuthorization方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。