public class SerializablePrincipal
extends java.lang.Object
implements java.io.Serializable
Realm implementations.
The GenericPrincipal does NOT implement serializable and I didn't want to
change that implementation hence I implemented this one instead.| Modifier and Type | Field and Description | 
|---|---|
| protected java.lang.String | nameThe username of the user represented by this Principal. | 
| protected java.lang.String | passwordThe authentication credentials for the user represented by
this Principal. | 
| protected Realm | realmThe Realm with which this Principal is associated. | 
| protected java.lang.String[] | rolesThe set of roles associated with this user. | 
| protected static StringManager | smThe string manager for this package. | 
| protected java.security.Principal | userPrincipalThe user principal, if present. | 
| Constructor and Description | 
|---|
| SerializablePrincipal() | 
| SerializablePrincipal(java.lang.String name,
java.lang.String password)Construct a new Principal, associated with the specified Realm, for the
specified username and password. | 
| SerializablePrincipal(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). | 
| SerializablePrincipal(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). | 
| Modifier and Type | Method and Description | 
|---|---|
| static SerializablePrincipal | createPrincipal(GenericPrincipal principal) | 
| java.lang.String | getName() | 
| java.lang.String | getPassword() | 
| GenericPrincipal | getPrincipal() | 
| Realm | getRealm() | 
| java.lang.String[] | getRoles() | 
| static GenericPrincipal | readPrincipal(java.io.ObjectInput in) | 
| void | setRealm(Realm realm) | 
| java.lang.String | toString()Return a String representation of this object, which exposes only
information that should be public. | 
| static void | writePrincipal(GenericPrincipal p,
java.io.ObjectOutput out) | 
protected static final StringManager sm
protected java.lang.String name
protected java.lang.String password
protected transient Realm realm
protected java.lang.String[] roles
protected java.security.Principal userPrincipal
public SerializablePrincipal()
public SerializablePrincipal(java.lang.String name,
                     java.lang.String password)
name - The username of the user represented by this Principalpassword - Credentials used to authenticate this userpublic SerializablePrincipal(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 SerializablePrincipal(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 user principal to be exposed to applicationspublic java.lang.String getName()
public java.lang.String getPassword()
public Realm getRealm()
public void setRealm(Realm realm)
public java.lang.String[] getRoles()
public java.lang.String toString()
toString in class java.lang.Objectpublic static SerializablePrincipal createPrincipal(GenericPrincipal principal)
public GenericPrincipal getPrincipal()
public static GenericPrincipal readPrincipal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
java.io.IOExceptionjava.lang.ClassNotFoundExceptionpublic static void writePrincipal(GenericPrincipal p, java.io.ObjectOutput out) throws java.io.IOException
java.io.IOExceptionCopyright © 2000-2015 Apache Software Foundation. All Rights Reserved.