Package org.apache.catalina.realm
Class GenericPrincipal
- java.lang.Object
-
- org.apache.catalina.realm.GenericPrincipal
-
-
Field Summary
Fields Modifier and Type Field Description protected String
name
The username of the user represented by this Principal.protected char[]
password
The authentication credentials for the user represented by this Principal.protected Realm
realm
The Realm with which this Principal is associated.protected String[]
roles
The set of roles associated with this user.
-
Constructor Summary
Constructors Constructor Description GenericPrincipal(String name, char[] password, List<String> roles)
GenericPrincipal(Realm realm, String name, char[] password)
Construct a new Principal, associated with the specified Realm, for the specified username and password.GenericPrincipal(Realm realm, String name, char[] password, List<String> roles)
Construct a new Principal, associated with the specified Realm, for the specified username and password, with the specified role names (as Strings).
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getName()
char[]
getPassword()
Realm
getRealm()
String[]
getRoles()
boolean
hasRole(String role)
Does the user represented by this Principal possess the specified role?String
toString()
Return a String representation of this object, which exposes only information that should be public.
-
-
-
Field Detail
-
name
protected String name
The username of the user represented by this Principal.
-
password
protected char[] password
The authentication credentials for the user represented by this Principal.
-
realm
protected Realm realm
The Realm with which this Principal is associated.
-
roles
protected String[] roles
The set of roles associated with this user.
-
-
Constructor Detail
-
GenericPrincipal
public GenericPrincipal(Realm realm, String name, char[] password)
Construct a new Principal, associated with the specified Realm, for the specified username and password.- Parameters:
realm
- The Realm that owns this Principalname
- The username of the user represented by this Principalpassword
- Credentials used to authenticate this user
-
GenericPrincipal
public GenericPrincipal(Realm realm, String name, char[] password, List<String> 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 principalname
- The username of the user represented by this Principalpassword
- Credentials used to authenticate this userroles
- List of roles (must be Strings) possessed by this user
-
-