Package org.apache.commons.httpclient.auth

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


    private Socket AuthenticateProxy(ConnectMethod method, ProxyClient client,
            String proxyHost, int proxyPort,
            String proxyUsername, String proxyPassword) throws IOException {  
        if(method.getProxyAuthState().getAuthScheme().getSchemeName().equalsIgnoreCase("ntlm")) {
            // If Auth scheme is NTLM, set NT credentials with blank host and domain name
            client.getState().setProxyCredentials(new AuthScope(proxyHost, proxyPort),
                            new NTCredentials(proxyUsername, proxyPassword,"",""));
        } else {
            // If Auth scheme is Basic/Digest, set regular Credentials
            client.getState().setProxyCredentials(new AuthScope(proxyHost, proxyPort),
                    new UsernamePasswordCredentials(proxyUsername, proxyPassword));
        }
       
        ProxyClient.ConnectResponse response = client.connect();
        Socket socket = response.getSocket();
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 (LOG.isDebugEnabled()) {
                LOG.debug("Authenticating with " + authscope);
View Full Code Here

        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 (LOG.isDebugEnabled()) {
View Full Code Here

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

        if (LOG.isDebugEnabled()) {
View Full Code Here

    private HttpClient clientFor(URL url) {
        final HttpClient client = new HttpClient();
        final String userInfo = url.getUserInfo();
        if (userInfo != null) {
            final String[] usernamePassword = userInfo.split(":");
            client.getState().setCredentials(new AuthScope(url.getHost(), url.getPort()), new UsernamePasswordCredentials(usernamePassword[0], usernamePassword[1]));
        }
        return client;
    }
View Full Code Here

   * @param client
   * @param credentials
   */
  private static void _setCredentials(HttpClient client, Credentials credentials) {
    client.getState().setCredentials(
        new AuthScope(credentials.host, credentials.port),
        new UsernamePasswordCredentials(credentials.username, credentials.password));   
  }
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 (LOG.isDebugEnabled()) {
                LOG.debug("Authenticating with " + authscope);
View Full Code Here

        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 (LOG.isDebugEnabled()) {
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.