public class GenericPrincipal
extends java.lang.Object
implements java.security.Principal
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)
Deprecated.
Unused
|
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() |
java.lang.String |
getName() |
java.lang.String |
getPassword() |
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.
|
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 java.lang.String name
protected java.lang.String password
protected java.lang.String[] roles
protected java.security.Principal userPrincipal
protected javax.security.auth.login.LoginContext loginContext
protected org.ietf.jgss.GSSCredential gssCredential
@Deprecated public GenericPrincipal(java.lang.String name, java.lang.String password)
name
- The username of the user represented by this Principalpassword
- Credentials used to authenticate this userpublic 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()
public org.ietf.jgss.GSSCredential getGssCredential()
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
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-2020 Apache Software Foundation. All Rights Reserved.