当前位置: 首页>>代码示例>>Java>>正文


Java HttpTransportProperties.Authenticator方法代码示例

本文整理汇总了Java中org.apache.axis2.transport.http.HttpTransportProperties.Authenticator方法的典型用法代码示例。如果您正苦于以下问题:Java HttpTransportProperties.Authenticator方法的具体用法?Java HttpTransportProperties.Authenticator怎么用?Java HttpTransportProperties.Authenticator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axis2.transport.http.HttpTransportProperties的用法示例。


在下文中一共展示了HttpTransportProperties.Authenticator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: Oauth2TokenValidator

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public Oauth2TokenValidator(String identityURL, String userName, String password)
        throws MalformedURLException, AxisFault {

    this.identityURL = identityURL;
    String adminUserName = userName;
    String adminPassword = password;

    //create service client with given url
    String targetEndpointUrl = identityURL + "/services/OAuth2TokenValidationService.OAuth2TokenValidationServiceHttpsSoap12Endpoint/";
    OAuth2TokenValidationServiceStub stub = new OAuth2TokenValidationServiceStub(targetEndpointUrl);
    oAuth2TokenValidationService = stub;

    ServiceClient client = stub._getServiceClient();
    HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
    authenticator.setUsername(adminUserName);
    authenticator.setPassword(adminPassword);
    authenticator.setPreemptiveAuthentication(true);
    Options options = client.getOptions();
    options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);

    client.setOptions(options);
}
 
开发者ID:GruppoFilippetti,项目名称:vertx-mqtt-broker,代码行数:23,代码来源:Oauth2TokenValidator.java

示例2: initializeRestClient

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
/**
 * Initialize the rest client and set username and password of the user
 *
 * @param serverURL server URL
 * @param username  username
 * @param password  password
 * @throws AxisFault
 */
private void initializeRestClient(String serverURL, String username, String password) throws AxisFault {
    HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
    authenticator.setUsername(username);
    authenticator.setPassword(password);
    authenticator.setPreemptiveAuthentication(true);

    ConfigurationContext configurationContext;
    try {
        configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
    } catch (Exception e) {
        String msg = "Backend error occurred. Please contact the service admins!";
        throw new AxisFault(msg, e);
    }
    HashMap<String, TransportOutDescription> transportsOut = configurationContext
            .getAxisConfiguration().getTransportsOut();
    for (TransportOutDescription transportOutDescription : transportsOut.values()) {
        transportOutDescription.getSender().init(configurationContext, transportOutDescription);
    }

    this.restClient = new RestClient(serverURL, username, password);
}
 
开发者ID:apache,项目名称:stratos,代码行数:30,代码来源:RestCommandLineService.java

示例3: WorkflowDeployerClient

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public WorkflowDeployerClient(String bpsURL, String username, char[] password) throws AxisFault {
    bpelUploaderStub = new BPELUploaderStub(bpsURL + BPEL_UPLOADER_SERVICE);
    ServiceClient serviceClient = bpelUploaderStub._getServiceClient();
    Options options = serviceClient.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(new String(password));
    auth.setPreemptiveAuthentication(true);
    List<String> authSchemes = new ArrayList<>();
    authSchemes.add(HttpTransportProperties.Authenticator.BASIC);
    auth.setAuthSchemes(authSchemes);
    options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    serviceClient.setOptions(options);

    humanTaskUploaderStub = new HumanTaskUploaderStub(bpsURL + HT_UPLOADER_SERVICE);
    ServiceClient htServiceClient = humanTaskUploaderStub._getServiceClient();
    Options htOptions = htServiceClient.getOptions();
    htOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    htServiceClient.setOptions(htOptions);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:21,代码来源:WorkflowDeployerClient.java

示例4: prepareStubInternal

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
private void prepareStubInternal(Stub stub)
{
    Options options = stub._getServiceClient().getOptions();
    options.setExceptionToBeThrownOnSOAPFault(true);
    options.setTimeOutInMilliSeconds(timeout);
    options.setManageSession(true);
    if (sessionCookie != null)
    {
        options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
    }
    options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);

    if (httpUsername != null && httpUsername.length() >= 0 && httpPassword != null)
    {
        HttpTransportProperties.Authenticator authenticator =
            new HttpTransportProperties.Authenticator();
        authenticator.setUsername(httpUsername);
        authenticator.setPassword(httpPassword);
        options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
    }
}
 
开发者ID:hschott,项目名称:cargo-wso2-container,代码行数:22,代码来源:AbstractWSO2Carbon4xRemoteService.java

示例5: sendForcefulShutDownRequest

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public static void sendForcefulShutDownRequest(String backendURL, String userName,
                                               String password) throws AutomationFrameworkException {
    try {
        ServiceClient serviceClient = new ServiceClient();
        Options opts = new Options();
        opts.setManageSession(true);
        opts.setTo(new EndpointReference(backendURL + "ServerAdmin"));
        opts.setAction("urn:shutdown");
        HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
        auth.setUsername(userName);
        auth.setPassword(password);
        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);

        serviceClient.setOptions(opts);
        serviceClient.sendReceive(ClientConnectionUtil.createPayLoadShutDownServerForcefully());

    } catch (AxisFault e) {
        log.error("Unable to shutdown carbon server forcefully..", e);
        throw new AutomationFrameworkException("Unable to shutdown carbon server forcefully..", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:22,代码来源:ClientConnectionUtil.java

示例6: sendGraceFullRestartRequest

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public static void sendGraceFullRestartRequest(String backendURL, String userName,
                                               String password) throws AutomationFrameworkException {
    try {
        ServiceClient serviceClient = new ServiceClient();
        Options opts = new Options();
        opts.setManageSession(true);
        opts.setTo(new EndpointReference(backendURL + "/ServerAdmin"));
        opts.setAction("urn:restart");
        HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
        auth.setUsername(userName);
        auth.setPassword(password);
        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);

        serviceClient.setOptions(opts);
        serviceClient.sendReceive(ClientConnectionUtil.createPayLoadRestartServerGracefully());

    } catch (AxisFault e) {
        log.error("Unable to restart carbon server gracefully..", e);
        throw new AutomationFrameworkException("Unable to restart carbon server gracefully..", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:22,代码来源:ClientConnectionUtil.java

示例7: setBasicAuth

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
/**
 * Ugly hack which only works due to the fact that the session server
 * doesn't verifiy the user's organization role
 * 
 * @param stub
 */
private void setBasicAuth(Stub stub) {
    HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
    basicAuth.setUsername(userKey);
    basicAuth.setPassword(password);
    basicAuth.setPreemptiveAuthentication(true);
    final Options clientOptions = stub._getServiceClient().getOptions();
    clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:15,代码来源:BssClient.java

示例8: authenticate

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
/**
 * Authenticates the service client from the username and password configured in RecoveryEndpointConfig.properties file
 *
 * @param client service client
 */
public void authenticate(ServiceClient client) {
    Options option = client.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(accessUsername);
    auth.setPassword(accessPassword);
    auth.setPreemptiveAuthentication(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    option.setManageSession(true);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:15,代码来源:IdentityManagementServiceUtil.java

示例9: authenticate

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public void authenticate(ServiceClient client) throws ApplicationManagementException {
    Options option = client.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(password);
    auth.setPreemptiveAuthentication(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    option.setManageSession(true);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:10,代码来源:ServiceAuthenticator.java

示例10: setupStub

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public static void setupStub(final @NotNull Stub stub, final @NotNull Credentials credentials, final @NotNull URI serverUri) {
  Options options = stub._getServiceClient().getOptions();

  // http params
  options.setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
  options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
  options.setProperty(HTTPConstants.SO_TIMEOUT, SOCKET_TIMEOUT);
  if (Registry.is("tfs.set.connection.timeout", false)) {
    options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, SOCKET_TIMEOUT);
  }

  // credentials
  if (credentials.getType() == Credentials.Type.Alternate) {
    String basicAuth =
      BasicScheme.authenticate(new UsernamePasswordCredentials(credentials.getUserName(), credentials.getPassword()), "UTF-8");
    Map<String, String> headers = new HashMap<String, String>();
    headers.put(HTTPConstants.HEADER_AUTHORIZATION, basicAuth);
    options.setProperty(HTTPConstants.HTTP_HEADERS, headers);
  }
  else {
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(credentials.getUserName());
    auth.setPassword(credentials.getPassword() != null ? credentials.getPassword() : "");
    auth.setDomain(credentials.getDomain());
    auth.setHost(serverUri.getHost());
    options.setProperty(HTTPConstants.AUTHENTICATE, auth);

    HttpMethodParams params = new HttpMethodParams();
    params.setBooleanParameter(USE_NATIVE_CREDENTIALS, credentials.getType() == Credentials.Type.NtlmNative);
    options.setProperty(HTTPConstants.HTTP_METHOD_PARAMS, params);
  }

  // proxy
  final HttpTransportProperties.ProxyProperties proxyProperties;
  final HTTPProxyInfo proxy = HTTPProxyInfo.getCurrent();
  if (proxy.host != null) {
    proxyProperties = new HttpTransportProperties.ProxyProperties();
    Pair<String, String> domainAndUser = getDomainAndUser(proxy.user);
    proxyProperties.setProxyName(proxy.host);
    proxyProperties.setProxyPort(proxy.port);
    proxyProperties.setDomain(domainAndUser.first);
    proxyProperties.setUserName(domainAndUser.second);
    proxyProperties.setPassWord(proxy.password);
  }
  else {
    proxyProperties = null;
  }

  options.setProperty(HTTPConstants.PROXY, proxyProperties);
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:51,代码来源:WebServiceHelper.java

示例11: authenticate

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public void authenticate(ServiceClient client) throws AppManagerConnectorException {
    Options option = client.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(password);
    auth.setPreemptiveAuthentication(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    option.setManageSession(true);
}
 
开发者ID:wso2-incubator,项目名称:iot-server-appliances,代码行数:10,代码来源:ServiceAuthenticator.java

示例12: BPELPackageManagementServiceClient

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public BPELPackageManagementServiceClient(String bpsURL, String username, char[] password) throws AxisFault {
    stub = new BPELPackageManagementServiceStub(bpsURL + WFImplConstant.BPS_PACKAGE_SERVICES_URL);
    ServiceClient serviceClient = stub._getServiceClient();
    Options options = serviceClient.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(new String(password));
    auth.setPreemptiveAuthentication(true);
    List<String> authSchemes = new ArrayList<>();
    authSchemes.add(HttpTransportProperties.Authenticator.BASIC);
    auth.setAuthSchemes(authSchemes);
    options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    serviceClient.setOptions(options);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:15,代码来源:BPELPackageManagementServiceClient.java

示例13: ProcessManagementServiceClient

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public ProcessManagementServiceClient(String bpsURL, String username, char[] password) throws AxisFault {
    stub = new ProcessManagementServiceStub(bpsURL + WFImplConstant.BPS_PROCESS_SERVICES_URL);
    ServiceClient serviceClient = stub._getServiceClient();
    Options options = serviceClient.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(new String(password));
    auth.setPreemptiveAuthentication(true);
    List<String> authSchemes = new ArrayList<>();
    authSchemes.add(HttpTransportProperties.Authenticator.BASIC);
    auth.setAuthSchemes(authSchemes);
    options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    serviceClient.setOptions(options);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:15,代码来源:ProcessManagementServiceClient.java

示例14: WSXACMLEntitlementServiceClient

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public WSXACMLEntitlementServiceClient(String serverUrl, String userName, String password) {
    this.serverUrl = serverUrl;
    authenticator = new HttpTransportProperties.Authenticator();
    authenticator.setUsername(userName);
    authenticator.setPassword(password);
    authenticator.setPreemptiveAuthentication(true);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:8,代码来源:WSXACMLEntitlementServiceClient.java

示例15: addConnection

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public void addConnection(ConnectionContext context, ConnectionInfo info)
        throws Exception {

    Options option = remoteUserStoreManagerServiceClient.getOptions();
    option.setProperty(HTTPConstants.COOKIE_STRING, remoteUserStoreManagerAuthCookie);
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(password);
    auth.setPreemptiveAuthentication(true);
    option.setProperty(HTTPConstants.AUTHENTICATE, auth);
    option.setManageSession(true);

    log.info("Authenticating the user .............");
    log.info("******************************************************");
    log.info("* Connecting to Identity Provider in Admin Privilege *");
    log.info("******************************************************\n");

    boolean isValidUser = remoteUserStoreManagerServiceStub.authenticate(info.getUserName(), info.getPassword());

    log.info("------------------------------------------------------");
    log.info("----------- Back to Normal Privilege -----------------");
    log.info("------------------------------------------------------\n");

    if (isValidUser) {
        log.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++");
        log.info("+++++++++  Valid user connection : " + info.getUserName());
        log.info("++++++++++++++++++++++++++++++++++++++++++++++++++++++\n");

        super.addConnection(context, info);
    } else {
        throw new SecurityException("Not a valid user connection");
    }
}
 
开发者ID:mohanvive,项目名称:mscworks,代码行数:34,代码来源:UserAuthenticationBroker.java


注:本文中的org.apache.axis2.transport.http.HttpTransportProperties.Authenticator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。