Package org.apache.commons.httpclient

Examples of org.apache.commons.httpclient.NTCredentials


          client.getState().setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                realm.length()==0 ? null : realm //"" is not the same as no realm
                                ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                  username,
                                    auth.getPass(),
                                    localHost,
                  domain
              ));
View Full Code Here


        if (useDynamicProxy){
            String user = getProxyUser();
            if (user.length() > 0){
                httpClient.getState().setProxyCredentials(
                        new AuthScope(proxyHost,proxyPort,null,AuthScope.ANY_SCHEME),
                        new NTCredentials(user,getProxyPass(),localHost,PROXY_DOMAIN)
                    );
            } else {
                httpClient.getState().clearProxyCredentials();
            }
        } else {
            if (useStaticProxy) {
                if (PROXY_USER.length() > 0){
                    httpClient.getState().setProxyCredentials(
                        new AuthScope(PROXY_HOST,PROXY_PORT,null,AuthScope.ANY_SCHEME),
                        new NTCredentials(PROXY_USER,PROXY_PASS,localHost,PROXY_DOMAIN)
                    );
                }
            } else {
                httpClient.getState().clearProxyCredentials();
            }
View Full Code Here

                    state.setCredentials(
                            new AuthScope(u.getHost(),u.getPort(),
                                    realm.length()==0 ? null : realm //"" is not the same as no realm
                                    ,AuthScope.ANY_SCHEME),
                            // NT Includes other types of Credentials
                            new NTCredentials(
                                    username,
                                    auth.getPass(),
                                    localHost,
                                    domain
                            ));
View Full Code Here

    hostConf.getParams().setParameter("http.default-headers", headers);
    if (useProxy) {
      hostConf.setProxy(proxyHost, proxyPort);
    }
    if (ntlmUsername.length() > 0) {
      Credentials ntCreds = new NTCredentials(ntlmUsername, ntlmPassword, ntlmHost, ntlmDomain);
      client.getState().setCredentials(new AuthScope(ntlmHost, AuthScope.ANY_PORT), ntCreds);

      if (LOG.isInfoEnabled()) {
        LOG.info("Added NTLM credentials for " + ntlmUsername);
      }
View Full Code Here

        String password = proxyProperties.getPassWord();
        String domain = proxyProperties.getDomain();

        Credentials proxyCred;
        if (userName != null && password != null && domain != null) {
            proxyCred = new NTCredentials(userName, password, proxyHost, domain);
        } else if (userName != null) {
            proxyCred = new UsernamePasswordCredentials(userName, password);
        } else {
            proxyCred = new UsernamePasswordCredentials("", "");
        }
View Full Code Here

        if (getProxyUsername() != null)
        {
            Credentials credentials;
            if (isProxyNtlmAuthentication())
            {
                credentials = new NTCredentials(getProxyUsername(), getProxyPassword(), getProxyHostname(), "");
            }
            else
            {
                credentials = new UsernamePasswordCredentials(getProxyUsername(), getProxyPassword());
            }
View Full Code Here

            throw new IllegalStateException("NTLM authentication process has not been initiated");
        }

        NtlmMessage response;

        NTCredentials ntcredentials = getNTCredentials(credentials);
        if (authenticationState == AUTHENTICATION_STATE.INITIATED || authenticationState == AUTHENTICATION_STATE.FAILED)
        {
            // Original implementation used ntCredential info instead of null values
            response = ntlmMessageFactory.createType1Message(null, null);
            authenticationState = AUTHENTICATION_STATE.TYPE1_MSG_GENERATED;
View Full Code Here

        password = "";

      if( authscheme instanceof NTLMScheme )
      {
        logger.info( host + ":" + port + " requires Windows authentication" );
        return new NTCredentials( wsdlRequest.getUsername(), password, host, wsdlRequest.getDomain() );
      }
      else if( authscheme instanceof RFC2617Scheme )
      {
        logger.info( host + ":" + port + " requires authentication with the realm '" + authscheme.getRealm() + "'" );
        return new UsernamePasswordCredentials( wsdlRequest.getUsername(), password );
View Full Code Here

            {
              String domain = proxyUsername.substring( 0, ix );
              if( proxyUsername.length() > ix + 1 )
              {
                String user = proxyUsername.substring( ix + 1 );
                proxyCreds = new NTCredentials( user, proxyPassword, proxyHost, domain );
              }
            }

            httpState.setProxyCredentials( AuthScope.ANY, proxyCreds );
          }
View Full Code Here

        if( authscheme instanceof NTLMScheme )
        {
          if( hasCredentials() )
          {
            log.info( "Returning url credentials" );
            return new NTCredentials( getUsername(), pw, host, null );
          }

          log.info( host + ":" + port + " requires Windows authentication" );
          if( ntDialog == null )
          {
            buildNtDialog();
          }

          StringToStringMap values = new StringToStringMap();
          values.put( "Info", "Authentication required for [" + host + ":" + port + "]" );
          ntDialog.setValues( values );

          if( ntDialog.show() )
          {
            values = ntDialog.getValues();
            NTCredentials credentials = new NTCredentials( values.get( "Username" ), values.get( "Password" ),
                host, values.get( "Domain" ) );

            cache.put( key, credentials );
            return credentials;
          }
View Full Code Here

TOP

Related Classes of org.apache.commons.httpclient.NTCredentials

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.