org.apache.catalina.realm
public class GenericPrincipal extends Object implements Principal
Realm
implementations.
Version: $Revision: 832626 $ $Date: 2009-11-04 01:08:46 +0100 (Wed, 04 Nov 2009) $
Field Summary | |
---|---|
protected LoginContext | loginContext
The JAAS LoginContext, if any, used to authenticate this Principal.
|
protected String | name
The username of the user represented by this Principal. |
protected String | 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. |
protected Principal | userPrincipal
The authenticated Principal to be exposed to applications. |
Constructor Summary | |
---|---|
GenericPrincipal(Realm realm, String name, String password)
Construct a new Principal, associated with the specified Realm, for the
specified username and password.
| |
GenericPrincipal(Realm realm, String name, String 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).
| |
GenericPrincipal(Realm realm, String name, String password, List<String> roles, Principal userPrincipal)
Construct a new Principal, associated with the specified Realm, for the
specified username and password, with the specified role names
(as Strings).
| |
GenericPrincipal(Realm realm, String name, String password, List<String> roles, Principal userPrincipal, LoginContext loginContext)
Construct a new Principal, associated with the specified Realm, for the
specified username and password, with the specified role names
(as Strings).
|
Method Summary | |
---|---|
String | getName() |
String | getPassword() |
Realm | getRealm() |
String[] | getRoles() |
Principal | getUserPrincipal() |
boolean | hasRole(String role)
Does the user represented by this Principal possess the specified role?
|
void | logout()
Calls logout, if necessary, on any associated JAASLoginContext. |
String | toString()
Return a String representation of this object, which exposes only
information that should be public. |
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
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
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
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 loginContext - If provided, this will be used to log out the user at the appropriate time
Parameters: role Role to be tested
Throws: Exception If something goes wrong with the logout. Uses Exception to allow for future expansion of this method to cover other logout mechanisms that might throw a different exception to LoginContext