org.apache.commons.httpclient

Class NTCredentials

Implemented Interfaces:
Credentials

public class NTCredentials
extends UsernamePasswordCredentials

Credentials for use with the NTLM authentication scheme which requires additional information.
Since:
2.0

Constructor Summary

NTCredentials()
Deprecated. Do not use.
NTCredentials(String userName, String password, String host, String domain)
Constructor.

Method Summary

boolean
equals(Object o)
Performs a case-sensitive check to see if the components of the credentials are the same.
String
getDomain()
Retrieves the name to authenticate with.
String
getHost()
Retrieves the host name of the computer originating the request.
int
hashCode()
Computes a hash code based on all the case-sensitive parts of the credentials object.
void
setDomain(String domain)
Deprecated. Do not use.
void
setHost(String host)
Deprecated. Do not use.
String
toString()
Return a string representation of this object.

Methods inherited from class org.apache.commons.httpclient.UsernamePasswordCredentials

equals, getPassword, getUserName, hashCode, setPassword, setUserName, toString

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Details

NTCredentials

public NTCredentials()

Deprecated. Do not use. Null user name, domain & host no longer allowed

Default constructor.

NTCredentials

public NTCredentials(String userName,
                     String password,
                     String host,
                     String domain)
Constructor.
Parameters:
userName - The user name. This should not include the domain to authenticate with. For example: "user" is correct whereas "DOMAIN\\user" is not.
password - The password.
host - The host the authentication request is originating from. Essentially, the computer name for this machine.
domain - The domain to authenticate within.
Usages and Demos :

View More Examples of NTCredentials(String userName,String password,String host,String domain)
   1:         Credentials credentials =
   2:             new NTCredentials( "testuser", "crazypass", "tobrien.discursive.com", "DOMAIN" );
   3:         client.getState().setCredentials( null, null, credentials );
   4: 
   5:         HttpMethod method = new GetMethod( url );

View Full Code Here
   1:                     String password = readConsole();
   2:                     return new NTCredentials(user, password, host, domain);    
   3:                 } else
   4:                 if (authscheme instanceof RFC2617Scheme) {
   5:                     System.out.println(host + ":" + port + " requires authentication with the realm '" 

View Full Code Here
   1:             {
   2:                 cred = new NTCredentials( _strProxyUserName, _strProxyPassword, _strHostName, _strDomainName );
   3:             }
   4:             else if ( ( _strProxyUserName != null ) && ( _strProxyPassword != null ) )
   5:             {

View Full Code Here
   1:             "1NURE9NQUlO";
   2:         NTCredentials cred = new NTCredentials("username","password", "host", "domain");
   3:         FakeHttpMethod method = new FakeHttpMethod(); 
   4:         ...
   5:             "9TVAaC+vLxUEHnUtpItj9Dp4kzwQfd61Lztg==";
   6:         NTCredentials cred = new NTCredentials("username","password", "host", "domain");
   7:         FakeHttpMethod method = new FakeHttpMethod(); 
   8:         ...
   9:         this.client.getState().setCredentials(AuthScope.ANY, 
  10:                 new NTCredentials("username", "password", "host", "domain"));
  11:         

View Full Code Here
   1:         final AuthScope scope = new AuthScope( host, port, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME );
   2:         final Credentials c = new NTCredentials( username, password, clientHost, clientDomain );
   3:         credentials_.put( scope, c );
   4:         ...
   5:         final AuthScope scope = new AuthScope( host, port, AuthScope.ANY_REALM, AuthScope.ANY_SCHEME );
   6:         final Credentials c = new NTCredentials( username, password, clientHost, clientDomain );
   7:         proxyCredentials_.put( scope, c );
   8:     }

View Full Code Here

Method Details

equals

public boolean equals(Object o)
Performs a case-sensitive check to see if the components of the credentials are the same.
Overrides:
equals in interface UsernamePasswordCredentials
Parameters:
o - The object to match.
Returns:
true if all of the credentials match.

getDomain

public String getDomain()
Retrieves the name to authenticate with.
Returns:
String the domain these credentials are intended to authenticate with.
Usages and Demos :

View More Examples of getDomain()
   1: import org.apache.commons.httpclient.HttpMethod;
   2: import org.apache.commons.httpclient.NTCredentials;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:     public static String authenticate(
   6:      final NTCredentials credentials, final String challenge) 
   7:       throws AuthenticationException {
   8:         ...
   9: 
  10:         LOG.trace("enter NTLMScheme.authenticate(NTCredentials, String)");
  11: 
  12:         ...
  13:         credentials.getUserName(), credentials.getPassword(),
  14:         credentials.getHost(), credentials.getDomain());

View Full Code Here

getHost

public String getHost()
Retrieves the host name of the computer originating the request.
Returns:
String the host the user is logged into.
Usages and Demos :

View More Examples of getHost()
   1: import org.apache.commons.httpclient.HttpMethod;
   2: import org.apache.commons.httpclient.NTCredentials;
   3: import org.apache.commons.logging.Log;
   4:         ...
   5:     public static String authenticate(
   6:      final NTCredentials credentials, final String challenge) 
   7:       throws AuthenticationException {
   8:         ...
   9: 
  10:         LOG.trace("enter NTLMScheme.authenticate(NTCredentials, String)");
  11: 
  12:         ...
  13:         credentials.getUserName(), credentials.getPassword(),
  14:         credentials.getHost(), credentials.getDomain());

View Full Code Here

hashCode

public int hashCode()
Computes a hash code based on all the case-sensitive parts of the credentials object.
Overrides:
hashCode in interface UsernamePasswordCredentials
Returns:
The hash code for the credentials.

setDomain

public void setDomain(String domain)

Deprecated. Do not use. The NTCredentials objects should be immutable

Sets the domain to authenticate with. The domain may not be null.
Parameters:
domain - the NT domain to authenticate in.
See Also:
getDomain()

setHost

public void setHost(String host)

Deprecated. Do not use. The NTCredentials objects should be immutable

Sets the host name of the computer originating the request. The host name may not be null.
Parameters:
host - the Host the user is logged into.

toString

public String toString()
Return a string representation of this object.
Overrides:
toString in interface UsernamePasswordCredentials
Returns:
A string represenation of this object.