Apache Tomcat 6.0.53

org.apache.catalina.ha.session
Class SerializablePrincipal

java.lang.Object
  extended by org.apache.catalina.ha.session.SerializablePrincipal
All Implemented Interfaces:
java.io.Serializable

public class SerializablePrincipal
extends java.lang.Object
implements java.io.Serializable

Generic implementation of java.security.Principal that is available for use by Realm implementations. The GenericPrincipal does NOT implement serializable and I didn't want to change that implementation hence I implemented this one instead.

Author:
Filip Hanik
See Also:
Serialized Form

Field Summary
protected static Log log
           
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 static StringManager sm
          The string manager for this package.
protected  java.security.Principal userPrincipal
          The user principal, if present.
 
Constructor Summary
SerializablePrincipal()
           
SerializablePrincipal(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.
SerializablePrincipal(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).
SerializablePrincipal(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).
 
Method Summary
static SerializablePrincipal createPrincipal(GenericPrincipal principal)
           
 java.lang.String getName()
           
 java.lang.String getPassword()
           
 GenericPrincipal getPrincipal(Realm realm)
           
 Realm getRealm()
           
 java.lang.String[] getRoles()
           
static GenericPrincipal readPrincipal(java.io.ObjectInput in, Realm realm)
           
 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)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected static Log log

sm

protected static StringManager sm
The string manager for this package.


name

protected java.lang.String name
The username of the user represented by this Principal.


password

protected java.lang.String password
The authentication credentials for the user represented by this Principal.


realm

protected transient Realm realm
The Realm with which this Principal is associated.


roles

protected java.lang.String[] roles
The set of roles associated with this user.


userPrincipal

protected java.security.Principal userPrincipal
The user principal, if present.

Constructor Detail

SerializablePrincipal

public SerializablePrincipal()

SerializablePrincipal

public SerializablePrincipal(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.

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

SerializablePrincipal

public SerializablePrincipal(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).

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

SerializablePrincipal

public SerializablePrincipal(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).

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 user principal to be exposed to applications
Method Detail

getName

public java.lang.String getName()

getPassword

public java.lang.String getPassword()

getRealm

public Realm getRealm()

setRealm

public void setRealm(Realm realm)

getRoles

public java.lang.String[] getRoles()

toString

public java.lang.String toString()
Return a String representation of this object, which exposes only information that should be public.

Overrides:
toString in class java.lang.Object

createPrincipal

public static SerializablePrincipal createPrincipal(GenericPrincipal principal)

getPrincipal

public GenericPrincipal getPrincipal(Realm realm)

readPrincipal

public static GenericPrincipal readPrincipal(java.io.ObjectInput in,
                                             Realm realm)
                                      throws java.io.IOException,
                                             java.lang.ClassNotFoundException
Throws:
java.io.IOException
java.lang.ClassNotFoundException

writePrincipal

public static void writePrincipal(GenericPrincipal p,
                                  java.io.ObjectOutput out)
                           throws java.io.IOException
Throws:
java.io.IOException

Apache Tomcat 6.0.53

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.