Package org.apache.commons.httpclient.auth

Examples of org.apache.commons.httpclient.auth.AuthScope


        AuthScheme authscheme = authstate.getAuthScheme();
        if (authscheme == null) {
            return;
        }
        if (authstate.isAuthRequested() || !authscheme.isConnectionBased()) {
            AuthScope authscope = new AuthScope(
                conn.getProxyHost(), conn.getProxyPort(),
                authscheme.getRealm(),
                authscheme.getSchemeName())
            if (LOG.isDebugEnabled()) {
                LOG.debug("Authenticating with " + authscope);
View Full Code Here


        String host = method.getParams().getVirtualHost();
        if (host == null) {
            host = conn.getHost();
        }
        int port = conn.getPort();
        AuthScope authscope = new AuthScope(
            host, port,
            authscheme.getRealm(),
            authscheme.getSchemeName())

        if (authstate.isAuthAttempted() && authscheme.isComplete()) {
View Full Code Here

            }
        }
        if (authscheme == null) {
            return false;
        }
        AuthScope authscope = new AuthScope(
            conn.getProxyHost(), conn.getProxyPort(),
            authscheme.getRealm(),
            authscheme.getSchemeName())

        if (authstate.isAuthAttempted() && authscheme.isComplete()) {
View Full Code Here

    String realm,
    String scheme,
    Credentials credentials)
      throws URISyntaxException {
    URI uri = new URI(target);
    AuthScope scope =
      new AuthScope(
        uri.getHost(),
        uri.getPort(),
        realm, scheme);
    client.getState().setCredentials(
      scope, credentials);
View Full Code Here

     * @param exchange the message exchange to be used for evaluating the expression
     * @param message the normalized message to be used for evaluating the expression
     * @throws MessagingException if the correct value for username/password cannot be determined when using an expression
     */
    public void applyCredentials(HttpClient client, MessageExchange exchange, NormalizedMessage message) throws MessagingException {
        AuthScope scope = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT);
        Credentials credentials =
            new UsernamePasswordCredentials((String) this.username.evaluate(exchange, message),
                    (String) this.password.evaluate(exchange, message));
        client.getState().setCredentials(scope, credentials);
    }
View Full Code Here

     * @param exchange the message exchange to be used for evaluating the expression
     * @param message the normalized message to be used for evaluating the expression
     * @throws MessagingException if the correct value for user name/password cannot be determined when using an expression
     */
    public void applyProxyCredentials(HttpClient client, MessageExchange exchange, NormalizedMessage message) throws MessagingException {
        AuthScope scope = new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT);
        Credentials credentials =
            new UsernamePasswordCredentials((String) this.username.evaluate(exchange, message),
                    (String) this.password.evaluate(exchange, message));
        client.getState().setProxyCredentials(scope, credentials);
    }
View Full Code Here

    }
   
    protected void testAuthenticate(final String username, final String password) throws Exception {
        HttpClient client = new HttpClient();
        client.getState().setCredentials(
            new AuthScope(AuthScope.ANY),
            new UsernamePasswordCredentials(username, password));
       
        PostMethod method = new PostMethod("http://localhost:8192/Service/");
        try {
            method.setDoAuthentication(true);
View Full Code Here

    if (useProxy) {
      hostConf.setProxy(proxyHost, proxyPort);

      if (proxyUsername.length() > 0) {

        AuthScope proxyAuthScope = getAuthScope(
            this.proxyHost, this.proxyPort, this.proxyRealm);

        NTCredentials proxyCredentials = new NTCredentials(
            this.proxyUsername, this.proxyPassword,
            this.agentHost, this.proxyRealm);
View Full Code Here

            }
            String realm = scopeElement.getAttribute("realm");
            String scheme = scopeElement.getAttribute("scheme");

            // Set credentials for the determined scope
            AuthScope authScope = getAuthScope(host, port, realm, scheme);
            NTCredentials credentials = new NTCredentials(
                username, password, agentHost, realm);

            client.getState().setCredentials(authScope, credentials);
View Full Code Here

          port = 443;
        else
          port = 80;
      }

      AuthScope scope = new AuthScope(url.getHost(), port);

      if (client.getState().getCredentials(scope) != null) {
        if (LOG.isTraceEnabled())
          LOG.trace("Pre-configured credentials with scope - host: "
              + url.getHost() + "; port: " + port
              + "; found for url: " + url);

        // Credentials are already configured, so do nothing and return
        return;
      }

      if (LOG.isTraceEnabled())
          LOG.trace("Pre-configured credentials with scope -  host: "
              + url.getHost() + "; port: " + port
              + "; not found for url: " + url);

      AuthScope serverAuthScope = getAuthScope(
          url.getHost(), port, defaultRealm, defaultScheme);

      NTCredentials serverCredentials = new NTCredentials(
          defaultUsername, defaultPassword,
          agentHost, defaultRealm);
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.auth.AuthScope

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.