public class GenericPrincipal extends java.lang.Object implements TomcatPrincipal, java.io.Serializable
Realm
implementations.Modifier and Type | Field and Description |
---|---|
protected org.ietf.jgss.GSSCredential |
gssCredential
The user's delegated credentials.
|
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 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 and Description |
---|
GenericPrincipal(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(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(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).
|
GenericPrincipal(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,
org.ietf.jgss.GSSCredential gssCredential)
Construct a new Principal, associated with the specified Realm, for the
specified username and password, with the specified role names
(as Strings).
|
Modifier and Type | Method and Description |
---|---|
org.ietf.jgss.GSSCredential |
getGssCredential()
The user's delegated credentials.
|
java.lang.String |
getName() |
java.lang.String |
getPassword() |
java.lang.String[] |
getRoles() |
java.security.Principal |
getUserPrincipal()
The authenticated Principal to be exposed to applications.
|
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.
|
protected void |
setGssCredential(org.ietf.jgss.GSSCredential gssCredential) |
java.lang.String |
toString()
Return a String representation of this object, which exposes only
information that should be public.
|
protected final java.lang.String name
protected final java.lang.String password
protected final java.lang.String[] roles
protected final java.security.Principal userPrincipal
protected final transient javax.security.auth.login.LoginContext loginContext
protected transient org.ietf.jgss.GSSCredential gssCredential
public GenericPrincipal(java.lang.String name, java.lang.String password, java.util.List<java.lang.String> roles)
name
- 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(java.lang.String name, java.lang.String password, java.util.List<java.lang.String> roles, java.security.Principal userPrincipal)
name
- 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(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)
name
- 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 timepublic GenericPrincipal(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, org.ietf.jgss.GSSCredential gssCredential)
name
- 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 timegssCredential
- - If provided, the user's delegated credentialspublic java.lang.String getName()
getName
in interface java.security.Principal
public java.lang.String getPassword()
public java.lang.String[] getRoles()
public java.security.Principal getUserPrincipal()
TomcatPrincipal
getUserPrincipal
in interface TomcatPrincipal
public org.ietf.jgss.GSSCredential getGssCredential()
TomcatPrincipal
getGssCredential
in interface TomcatPrincipal
protected void setGssCredential(org.ietf.jgss.GSSCredential gssCredential)
public boolean hasRole(java.lang.String role)
role
- Role to be testedtrue
if this Principal has been assigned the given
role, otherwise false
public java.lang.String toString()
toString
in interface java.security.Principal
toString
in class java.lang.Object
public void logout() throws java.lang.Exception
logout
in interface TomcatPrincipal
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 LoginContextCopyright © 2000-2018 Apache Software Foundation. All Rights Reserved.