Examples of UsernamePasswordCredentials


Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

    String proxyPassword = proxySettings.getHttpProxyPassword();

    client.getHostConfiguration().setProxy(proxyHost, proxyPort);
    if (proxyUsername != null && !"".equals(proxyUsername))
    {
      Credentials credentials = new UsernamePasswordCredentials(proxyUsername, proxyPassword);
      client.getState().setProxyCredentials(AuthScope.ANY, credentials);
    }
  }
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

        if (creds.getDomain() != null)
          client.getState().setProxyCredentials(proxyAuthScope, new NTCredentials(user, pw, creds.getHost(), creds.getDomain()));

        /* Use normal Credentials if Domain is not set */
        else
          client.getState().setProxyCredentials(proxyAuthScope, new UsernamePasswordCredentials(user, pw));
      }
    }
  }
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

        if (creds.getDomain() != null)
          client.getState().setProxyCredentials(proxyAuthScope, new NTCredentials(user, pw, creds.getHost(), creds.getDomain()));

        /* Use normal Credentials if Domain is not set */
        else
          client.getState().setProxyCredentials(proxyAuthScope, new UsernamePasswordCredentials(user, pw));
      }
    }
  }
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

      {
         log.debug("Connecting to: "+url);
         String userInfo = url.getUserInfo();
         if( userInfo != null )
         {
            UsernamePasswordCredentials auth = new UsernamePasswordCredentials(userInfo);
            httpConn.getState().setCredentials(realm, url.getHost(), auth);
         }
         log.debug("RequestURI: "+request.getURI());
         int responseCode = httpConn.executeMethod(request);
         String response = request.getStatusText();
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

    HttpClient c = new HttpClient(connectionManager);

    // use basic authentication if available
    if (user != null && user.length() > 0) {
      AuthScope authScope = new AuthScope(null, -1, null);
      Credentials credentials = new UsernamePasswordCredentials(user, password);
      c.getState().setCredentials(authScope, credentials);
    }
    return c;
  }
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

      // gives an unauthorized response in certain situations, thus reducing the overhead of making the
      // connection.
      client.getState().setAuthenticationPreemptive(true);

      // Set up the WMS credentials:
      Credentials credentials = new UsernamePasswordCredentials(authentication.getUser(),
          authentication.getPassword());
      client.getState().setCredentials(authentication.getRealm(), parseDomain(url), credentials);
    }

    // Create the GET method with the correct URL:
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

      {
         log.debug("Connecting to: "+url);
         String userInfo = url.getUserInfo();
         if( userInfo != null )
         {
            UsernamePasswordCredentials auth = new UsernamePasswordCredentials(userInfo);
            httpConn.getState().setCredentials(realm, url.getHost(), auth);
         }
         log.debug("RequestURI: "+request.getURI());
         int responseCode = httpConn.executeMethod(request);
         String response = request.getStatusText();
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

         log.info("Connecting to: "+ url);
         String userInfo = url.getUserInfo();

         if( userInfo != null )
         {
            UsernamePasswordCredentials auth = new UsernamePasswordCredentials(userInfo);
            httpConn.getState().setCredentials("JBossTest Servlets", url.getHost(), auth);
         }
         log.info("RequestURI: "+request.getURI());
         int responseCode = httpConn.executeMethod(request);
         String response = request.getStatusText();
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

         log.info("Connecting to: "+ url);
         String userInfo = url.getUserInfo();

         if( userInfo != null )
         {
            UsernamePasswordCredentials auth = new UsernamePasswordCredentials(userInfo);
            httpConn.getState().setCredentials(realm, url.getHost(), auth);
         }
         log.info("RequestURI: "+request.getURI());
         int responseCode = httpConn.executeMethod(request);
         String response = request.getStatusText();
View Full Code Here

Examples of org.apache.commons.httpclient.UsernamePasswordCredentials

  }
 
  @Test
  public void testSecureLinksAdmin() throws Exception
  {
    httpClient.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("admin", "asd"));
    Book book = client.getBookXML("foo");
    checkBookLinks1(url, book, "add", "update", "list", "self", "remove");
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.