/** * The constructor with the username and password arguments. * * @param userName the user name * @param password the password */ public UsernamePasswordCredentials(String userName, String password) { super(); if (userName == null) { throw new IllegalArgumentException("Username may not be null"); } this.principal = new BasicUserPrincipal(userName); this.password = password; }
public String getUserName() { return this.principal.getName(); }
@Override public int hashCode() { return this.principal.hashCode(); }
@Override public String toString() { return this.principal.toString(); }
@Override public String toString() { return this.principal.toString(); }
/** * The constructor with the username and password combined string argument. * * @param usernamePassword the username:password formed string * @see #toString */ public UsernamePasswordCredentials(String usernamePassword) { super(); if (usernamePassword == null) { throw new IllegalArgumentException("Username:password string may not be null"); } int atColon = usernamePassword.indexOf(':'); if (atColon >= 0) { this.principal = new BasicUserPrincipal(usernamePassword.substring(0, atColon)); this.password = usernamePassword.substring(atColon + 1); } else { this.principal = new BasicUserPrincipal(usernamePassword); this.password = null; } }
public String getUserName() { return this.principal.getName(); }
@Override public int hashCode() { return this.principal.hashCode(); }
@Override public String toString() { return this.principal.toString(); }
public void setPrincipal( String userName ) { if (userName == null) { principal = null; } principal = new BasicUserPrincipal( userName ); }
public String getUserName() { return this.principal.getName(); }
@Override public int hashCode() { return this.principal.hashCode(); }
@Override public String toString() { return this.principal.toString(); }
@Override public Principal getUserPrincipal() { return new BasicUserPrincipal(login); }
public String getUserName() { return this.principal.getName(); }
@Override public int hashCode() { return this.principal.hashCode(); }
@Override public String toString() { return this.principal.toString(); }
@Override public Principal getUserPrincipal() { return new BasicUserPrincipal(login); }
public String getUserName() { return this.principal.getName(); }
@Override public int hashCode() { return this.principal.hashCode(); }