|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.catalina.realm.GenericPrincipal
public class GenericPrincipal
Generic implementation of java.security.Principal that
is available for use by Realm
implementations.
Field Summary | |
---|---|
protected javax.security.auth.login.LoginContext |
loginContext
The JAAS LoginContext, if any, used to authenticate this Principal. |
protected java.lang.String |
name
The username of the user represented by this Principal. |
protected java.lang.String |
password
The authentication credentials for the user represented by this Principal. |
protected Realm |
realm
The Realm with which this Principal is associated. |
protected java.lang.String[] |
roles
The set of roles associated with this user. |
protected java.security.Principal |
userPrincipal
The authenticated Principal to be exposed to applications. |
Constructor Summary | |
---|---|
GenericPrincipal(Realm realm,
java.lang.String name,
java.lang.String password)
Construct a new Principal, associated with the specified Realm, for the specified username and password. |
|
GenericPrincipal(Realm realm,
java.lang.String name,
java.lang.String password,
java.util.List<java.lang.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,
java.lang.String name,
java.lang.String password,
java.util.List<java.lang.String> roles,
java.security.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,
java.lang.String name,
java.lang.String password,
java.util.List<java.lang.String> roles,
java.security.Principal userPrincipal,
javax.security.auth.login.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 | |
---|---|
java.lang.String |
getName()
|
java.lang.String |
getPassword()
|
Realm |
getRealm()
|
java.lang.String[] |
getRoles()
|
java.security.Principal |
getUserPrincipal()
|
boolean |
hasRole(java.lang.String role)
Does the user represented by this Principal possess the specified role? |
void |
logout()
Calls logout, if necessary, on any associated JAASLoginContext. |
java.lang.String |
toString()
Return a String representation of this object, which exposes only information that should be public. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.security.Principal |
---|
equals, hashCode |
Field Detail |
---|
protected java.lang.String name
protected java.lang.String password
protected Realm realm
protected java.lang.String[] roles
protected java.security.Principal userPrincipal
protected javax.security.auth.login.LoginContext loginContext
Constructor Detail |
---|
public GenericPrincipal(Realm realm, java.lang.String name, java.lang.String password)
realm
- The Realm that owns this Principalname
- The username of the user represented by this Principalpassword
- Credentials used to authenticate this userpublic GenericPrincipal(Realm realm, java.lang.String name, java.lang.String password, java.util.List<java.lang.String> roles)
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 userpublic GenericPrincipal(Realm realm, java.lang.String name, java.lang.String password, java.util.List<java.lang.String> roles, java.security.Principal userPrincipal)
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 useruserPrincipal
- - the principal to be returned from the request
getUserPrincipal call if not null; if null, this will be returnedpublic GenericPrincipal(Realm realm, java.lang.String name, java.lang.String password, java.util.List<java.lang.String> roles, java.security.Principal userPrincipal, javax.security.auth.login.LoginContext loginContext)
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 useruserPrincipal
- - the principal to be returned from the request
getUserPrincipal call if not null; if null, this will be returnedloginContext
- - If provided, this will be used to log out the user
at the appropriate timeMethod Detail |
---|
public java.lang.String getName()
getName
in interface java.security.Principal
public java.lang.String getPassword()
public Realm getRealm()
public java.lang.String[] getRoles()
public java.security.Principal getUserPrincipal()
public boolean hasRole(java.lang.String role)
role
- Role to be testedpublic java.lang.String toString()
toString
in interface java.security.Principal
toString
in class java.lang.Object
public void logout() throws java.lang.Exception
java.lang.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
|
Apache Tomcat 6.0.53 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |