Examples of AuthScope


Examples of com.google.api.explorer.client.base.ApiService.AuthScope

  private Map<String, AuthInformation> generateAuthInformation(Set<String> scopes) {
    Map<String, AuthScope> authScopes = Maps.newHashMap();

    for (String scopeName : scopes) {
      AuthScope mockScope = EasyMock.createMock(AuthScope.class);
      EasyMock.replay(mockScope);
      authScopes.put(scopeName, mockScope);
    }

    AuthInformation mockAuth = EasyMock.createMock(AuthInformation.class);
View Full Code Here

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

                        creds = new NTCredentials(username, password, host, domain);
                    } else {
                        /*Credentials for Digest and Basic Authentication*/
                        creds = new UsernamePasswordCredentials(username, password);
                    }
                    agent.getState().setCredentials(new AuthScope(host, port, realm), creds);
                } else {
                    if (domain != null) {
                        /*Credentials for NTLM Authentication when host is ANY_HOST*/
                        creds = new NTCredentials(username, password, AuthScope.ANY_HOST, domain);
                        agent.getState().setCredentials(
                                new AuthScope(AuthScope.ANY_HOST, port, realm), creds);
                    } else {
                        /*Credentials only for Digest and Basic Authentication*/
                        creds = new UsernamePasswordCredentials(username, password);
                        agent.getState().setCredentials(new AuthScope(AuthScope.ANY), creds);
                    }
                }
                /* Customizing the priority Order */
                List schemes = authenticator.getAuthSchemes();
                if (schemes != null && schemes.size() > 0) {
View Full Code Here

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

          mDestination.getName(), "Realm");
      String password = config.getValueOptional(Constants.CHAPTER_SYSTEM,
          mDestination.getName(), "Password");
      HttpState state = client.getState();
      state.setCredentials(
          new AuthScope(client.getHostConfiguration().getHost(),
              client.getHostConfiguration().getPort(), realm),
          new UsernamePasswordCredentials(user, password));
      HttpClientParams params = new HttpClientParams();
      params.setAuthenticationPreemptive(config.getValueAsBooleanOptional(
          Constants.CHAPTER_SYSTEM, mDestination.getName(),
View Full Code Here

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

  public void setUsernameAndPassword(String username, String password) {
    if (username != null && password != null) {
      logger.debug("Setting username '{}' and password for server at {}.", username, serverURL);
      try {
        URL server = new URL(serverURL);
        authScope = new AuthScope(server.getHost(), AuthScope.ANY_PORT);
        httpClient.getState().setCredentials(authScope,
            new UsernamePasswordCredentials(username, password));
        httpClient.getParams().setAuthenticationPreemptive(true);
      }
      catch (MalformedURLException e) {
View Full Code Here

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

            hc = hClient.getHostConfiguration();
            hc = setProxySetttings(hClient, hc);

            hClient.getState()
                .setCredentials(
                    new AuthScope(AuthScope.ANY_HOST,
                        AuthScope.ANY_PORT,
                        AuthScope.ANY_REALM),
                    getCredentials(feed));

            gMethod = new GetMethod(url.toString());
View Full Code Here

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

          } else {
            if (status == HttpStatus.SC_UNAUTHORIZED) {
              hc = hClient.getHostConfiguration();
              hc = setProxySetttings(hClient, hc);
              hClient.getState().setCredentials(
                  new AuthScope(AuthScope.ANY_HOST,
                      AuthScope.ANY_PORT,
                      AuthScope.ANY_REALM),
                  getCredentials(pFeed));
              gMethod = new GetMethod(url.toString());
              gMethod.setDoAuthentication(true);
View Full Code Here

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

            // Retry with password.
            hc = hClient.getHostConfiguration();
            try {

              hClient.getState().setCredentials(
                  new AuthScope(AuthScope.ANY_HOST,
                      AuthScope.ANY_PORT,
                      AuthScope.ANY_REALM),
                  getCredentials(feed)

              );
View Full Code Here

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

            // Retry with password.
            hc = hClient.getHostConfiguration();
            hc = setProxySetttings(hClient, hc);
            hClient.getState()
                .setCredentials(
                    new AuthScope(AuthScope.ANY_HOST,
                        AuthScope.ANY_PORT,
                        AuthScope.ANY_REALM),
                    getCredentials(pDownload
                        .getAttachment().getNews()
                        .getFeedReference().resolve()));
View Full Code Here

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

      /* Authenticate if required */
      if (creds.getUsername() != null || creds.getPassword() != null) {
        String user = StringUtils.isSet(creds.getUsername()) ? creds.getUsername() : ""; //$NON-NLS-1$
        String pw = StringUtils.isSet(creds.getPassword()) ? creds.getPassword() : ""; //$NON-NLS-1$

        AuthScope proxyAuthScope = new AuthScope(creds.getHost(), creds.getPort());

        /* Use NTLM Credentials if Domain is set */
        if (creds.getDomain() != null)
          client.getState().setProxyCredentials(proxyAuthScope, new NTCredentials(user, pw, creds.getHost(), creds.getDomain()));

View Full Code Here

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

      /* Authenticate if required */
      if (creds.getUsername() != null || creds.getPassword() != null) {
        String user = StringUtils.isSet(creds.getUsername()) ? creds.getUsername() : "";
        String pw = StringUtils.isSet(creds.getPassword()) ? creds.getPassword() : "";

        AuthScope proxyAuthScope = new AuthScope(creds.getHost(), creds.getPort());

        /* Use NTLM Credentials if Domain is set */
        if (creds.getDomain() != null)
          client.getState().setProxyCredentials(proxyAuthScope, new NTCredentials(user, pw, creds.getHost(), creds.getDomain()));

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.