| Constructor: |
public GenericPrincipal(Realm realm,
String name,
String password) {
this(realm, name, password, null);
}
Construct a new Principal, associated with the specified Realm, for the
specified username and password. Parameters:
realm - The Realm that owns this Principal
name - The username of the user represented by this Principal
password - Credentials used to authenticate this user
|
public GenericPrincipal(Realm realm,
String name,
String password,
List roles) {
this(realm, name, password, roles, null);
}
Construct a new Principal, associated with the specified Realm, for the
specified username and password, with the specified role names
(as Strings). Parameters:
realm - The Realm that owns this principal
name - The username of the user represented by this Principal
password - Credentials used to authenticate this user
roles - List of roles (must be Strings) possessed by this user
|
public GenericPrincipal(Realm realm,
String name,
String password,
List roles,
Principal userPrincipal) {
super();
this.realm = realm;
this.name = name;
this.password = password;
this.userPrincipal = userPrincipal;
if (roles != null) {
this.roles = new String[roles.size()];
this.roles = (String[]) roles.toArray(this.roles);
if (this.roles.length > 0)
Arrays.sort(this.roles);
}
}
Construct a new Principal, associated with the specified Realm, for the
specified username and password, with the specified role names
(as Strings). Parameters:
realm - The Realm that owns this principal
name - The username of the user represented by this Principal
password - Credentials used to authenticate this user
roles - List of roles (must be Strings) possessed by this user
userPrincipal - - the principal to be returned from the request
getUserPrincipal call if not null; if null, this will be returned
|
| Method from org.apache.catalina.realm.GenericPrincipal Detail: |
public String getName() {
return (this.name);
}
|
public String getPassword() {
return (this.password);
}
|
public Realm getRealm() {
return (this.realm);
}
|
public String[] getRoles() {
return (this.roles);
}
|
public Principal getUserPrincipal() {
if (userPrincipal != null) {
return userPrincipal;
} else {
return this;
}
}
|
public boolean hasRole(String role) {
if("*".equals(role)) // Special 2.4 role meaning everyone
return true;
if (role == null)
return (false);
return (Arrays.binarySearch(roles, role) >= 0);
}
Does the user represented by this Principal possess the specified role? |
void setRealm(Realm realm) {
this.realm=realm;
}
|
public String toString() {
StringBuffer sb = new StringBuffer("GenericPrincipal[");
sb.append(this.name);
sb.append("(");
for( int i=0;i< roles.length; i++ ) {
sb.append( roles[i]).append(",");
}
sb.append(")]");
return (sb.toString());
}
Return a String representation of this object, which exposes only
information that should be public. |