NTCredentialspublic class NTCredentials extends Object implements Credentials{@link Credentials} specific to the Windows platform. |
Fields Summary |
---|
private final NTUserPrincipal | principalThe user principal | private final String | passwordPassword | private final String | workstationThe host the authentication request is originating from. |
Constructors Summary |
---|
public NTCredentials(String usernamePassword)The constructor with the fully qualified username and password combined
string argument.
super();
if (usernamePassword == null) {
throw new IllegalArgumentException("Username:password string may not be null");
}
String username;
int atColon = usernamePassword.indexOf(':");
if (atColon >= 0) {
username = usernamePassword.substring(0, atColon);
this.password = usernamePassword.substring(atColon + 1);
} else {
username = usernamePassword;
this.password = null;
}
int atSlash = username.indexOf('/");
if (atSlash >= 0) {
this.principal = new NTUserPrincipal(
username.substring(0, atSlash).toUpperCase(Locale.ENGLISH),
username.substring(atSlash + 1));
} else {
this.principal = new NTUserPrincipal(
null,
username.substring(atSlash + 1));
}
this.workstation = null;
| public NTCredentials(String userName, String password, String workstation, String domain)Constructor.
super();
if (userName == null) {
throw new IllegalArgumentException("User name may not be null");
}
this.principal = new NTUserPrincipal(domain, userName);
this.password = password;
if (workstation != null) {
this.workstation = workstation.toUpperCase(Locale.ENGLISH);
} else {
this.workstation = null;
}
|
Methods Summary |
---|
public boolean | equals(java.lang.Object o)
if (o == null) return false;
if (this == o) return true;
if (o instanceof NTCredentials) {
NTCredentials that = (NTCredentials) o;
if (LangUtils.equals(this.principal, that.principal)
&& LangUtils.equals(this.workstation, that.workstation)) {
return true;
}
}
return false;
| public java.lang.String | getDomain()Retrieves the name to authenticate with.
return this.principal.getDomain();
| public java.lang.String | getPassword()
return this.password;
| public java.lang.String | getUserName()
return this.principal.getUsername();
| public java.security.Principal | getUserPrincipal()
return this.principal;
| public java.lang.String | getWorkstation()Retrieves the workstation name of the computer originating the request.
return this.workstation;
| public int | hashCode()
int hash = LangUtils.HASH_SEED;
hash = LangUtils.hashCode(hash, this.principal);
hash = LangUtils.hashCode(hash, this.workstation);
return hash;
| public java.lang.String | toString()
StringBuilder buffer = new StringBuilder();
buffer.append("[principal: ");
buffer.append(this.principal);
buffer.append("][workstation: ");
buffer.append(this.workstation);
buffer.append("]");
return buffer.toString();
|
|