org.apache.commons.httpclient

Class UsernamePasswordCredentials

Implemented Interfaces:
Credentials
Known Direct Subclasses:
NTCredentials

public class UsernamePasswordCredentials
extends Object
implements Credentials

Username and password Credentials.

Constructor Summary

UsernamePasswordCredentials()
Deprecated. Do not use.
UsernamePasswordCredentials(String usernamePassword)
The constructor with the username and password combined string argument.
UsernamePasswordCredentials(String userName, String password)
The constructor with the username and password arguments.

Method Summary

boolean
equals(Object o)
These credentials are assumed equal if the username and password are the same.
String
getPassword()
Password property getter.
String
getUserName()
User name property getter.
int
hashCode()
Does a hash of both user name and password.
void
setPassword(String password)
Deprecated. Do not use.
void
setUserName(String userName)
Deprecated. Do not use.
String
toString()
Get this object string.

Methods inherited from class java.lang.Object

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

Constructor Details

UsernamePasswordCredentials

public UsernamePasswordCredentials()

Deprecated. Do not use. Null user name no longer allowed

Default constructor.

UsernamePasswordCredentials

public UsernamePasswordCredentials(String usernamePassword)
The constructor with the username and password combined string argument.
Parameters:
usernamePassword - the username:password formed string
See Also:
toString()
Usages and Demos :

View More Examples of UsernamePasswordCredentials(String usernamePassword)
   1:          {
   2:             UsernamePasswordCredentials auth = new UsernamePasswordCredentials(userInfo);
   3:             httpConn.getState().setCredentials(realm, url.getHost(), auth);
   4:          }
   5:          log.debug("RequestURI: "+request.getURI());

View Full Code Here
   1:         UsernamePasswordCredentials credentials =
   2:                 new UsernamePasswordCredentials(login + "@" + getActiveRoleString(user.getActiveRoleIds()), user.getPassword());
   3:         httpState.setCredentials(null, null, credentials);
   4: 
   5:         DaisyHttpClient httpClient = new DaisyHttpClient(context.getSharedHttpClient(), context.getSharedHostConfiguration(), httpState);

View Full Code Here
   1:             
   2:             return new UsernamePasswordCredentials(creds.getUsername(), creds
   3:                     .getPassword());    
   4:         }
   5:         

View Full Code Here
   1:         try {
   2:             upc = new UsernamePasswordCredentials(getLogin(curi),
   3:                 getPassword(curi));
   4:             http.getState().setCredentials(new AuthScope(curi.getUURI().getHost(),
   5:                 curi.getUURI().getPort(), authRealm), upc);

View Full Code Here
   1:                 Credentials proxyCred =
   2:                         new UsernamePasswordCredentials(tcp.getProxyUser(),
   3:                                                         tcp.getProxyPassword());
   4:         ...
   5:                 Credentials proxyCred =
   6:                         new UsernamePasswordCredentials(tcp.getProxyUser(),
   7:                                                         tcp.getProxyPassword());
   8: 
   9:                 state.setProxyCredentials(null, proxyCred);

View Full Code Here

UsernamePasswordCredentials

public UsernamePasswordCredentials(String userName,
                                   String password)
The constructor with the username and password arguments.
Parameters:
userName - the user name
password - the password
Usages and Demos :

View More Examples of UsernamePasswordCredentials(String userName,String password)
   1:         Credentials credentials =
   2:             new UsernamePasswordCredentials("davuser", "davpass");
   3: 
   4:         WebdavResource resource = new WebdavResource(url, credentials);

View Full Code Here
   1:         Credentials credentials =
   2:             new UsernamePasswordCredentials( "testuser", "crazypass" );
   3:         state.setCredentials( null, null, credentials );
   4:         params.setAuthenticationPreemptive( true );

View Full Code Here
   1:         Credentials credentials =
   2:             new UsernamePasswordCredentials("davuser", "davpass");
   3: 
   4:         WebdavResource resource = new WebdavResource(url, credentials);
   5:         WebdavResource[] resources = resource.listWebdavResources();

View Full Code Here
   1:         Credentials credentials =
   2:             new UsernamePasswordCredentials("davuser", "davpass");
   3: 
   4:         WebdavResource resource = new WebdavResource(url, credentials);

View Full Code Here
   1:             new AuthScope("10.0.1.1", 3128, null),
   2:             new UsernamePasswordCredentials("proxy", "proxy"));
   3:         
   4:         ProxyClient.ConnectResponse response = proxyclient.connect(); 
   5:         

View Full Code Here

Method Details

equals

public boolean equals(Object o)
These credentials are assumed equal if the username and password are the same.
Overrides:
equals in interface Object
Parameters:
o - The other object to compare with.
Returns:
true if the object is equivalent.

getPassword

public String getPassword()
Password property getter.
Returns:
the password
Usages and Demos :

View More Examples of getPassword()
   1: import org.apache.commons.httpclient.NameValuePair;
   2: import org.apache.commons.httpclient.UsernamePasswordCredentials;
   3: import org.apache.commons.httpclient.util.EncodingUtil;
   4:         ...
   5: 
   6:         UsernamePasswordCredentials usernamepassword = null;
   7:         try {
   8:         ...
   9:             usernamepassword = (UsernamePasswordCredentials) credentials;
  10:         } catch (ClassCastException e) {
  11:         ...
  12:             usernamepassword.getUserName(),
  13:             usernamepassword.getPassword());

View Full Code Here

getUserName

public String getUserName()
User name property getter.
Returns:
the userName
Usages and Demos :

View More Examples of getUserName()
   1: import org.apache.commons.httpclient.NameValuePair;
   2: import org.apache.commons.httpclient.UsernamePasswordCredentials;
   3: import org.apache.commons.httpclient.util.EncodingUtil;
   4:         ...
   5: 
   6:         UsernamePasswordCredentials usernamepassword = null;
   7:         try {
   8:         ...
   9:             usernamepassword = (UsernamePasswordCredentials) credentials;
  10:         } catch (ClassCastException e) {
  11:         ...
  12:         String digest = createDigest(
  13:             usernamepassword.getUserName(),

View Full Code Here

hashCode

public int hashCode()
Does a hash of both user name and password.
Overrides:
hashCode in interface Object
Returns:
The hash code including user name and password.

setPassword

public void setPassword(String password)

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

Password property setter.
Parameters:
password -
See Also:
getPassword()

setUserName

public void setUserName(String userName)

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

User name property setter. User name may not be null.
Parameters:
userName -
See Also:
getUserName()

toString

public String toString()
Get this object string.
Overrides:
toString in interface Object
Returns:
the username:password formed string