org.apache.catalina.ha.session

Class SerializablePrincipal

public class SerializablePrincipal extends Object implements 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.

Version: $Revision: 610930 $ $Date: 2008-01-10 22:09:27 +0100 (Thu, 10 Jan 2008) $

Author: Filip Hanik

Field Summary
protected static Loglog
protected Stringname
The username of the user represented by this Principal.
protected Stringpassword
The authentication credentials for the user represented by this Principal.
protected Realmrealm
The Realm with which this Principal is associated.
protected String[]roles
The set of roles associated with this user.
protected static StringManagersm
The string manager for this package.
protected PrincipaluserPrincipal
The user principal, if present.
Constructor Summary
SerializablePrincipal()
SerializablePrincipal(Realm realm, String name, String password)
Construct a new Principal, associated with the specified Realm, for the specified username and password.
SerializablePrincipal(Realm realm, String name, String password, List<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, String name, String password, List<String> roles, 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 SerializablePrincipalcreatePrincipal(GenericPrincipal principal)
StringgetName()
StringgetPassword()
GenericPrincipalgetPrincipal(Realm realm)
RealmgetRealm()
String[]getRoles()
static GenericPrincipalreadPrincipal(ObjectInput in, Realm realm)
voidsetRealm(Realm realm)
StringtoString()
Return a String representation of this object, which exposes only information that should be public.
static voidwritePrincipal(GenericPrincipal p, ObjectOutput out)

Field Detail

log

protected static Log log

name

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

password

protected 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 String[] roles
The set of roles associated with this user.

sm

protected static StringManager sm
The string manager for this package.

userPrincipal

protected Principal userPrincipal
The user principal, if present.

Constructor Detail

SerializablePrincipal

public SerializablePrincipal()

SerializablePrincipal

public SerializablePrincipal(Realm realm, String name, 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, String name, String password, List<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, String name, String password, List<String> roles, 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

createPrincipal

public static SerializablePrincipal createPrincipal(GenericPrincipal principal)

getName

public String getName()

getPassword

public String getPassword()

getPrincipal

public GenericPrincipal getPrincipal(Realm realm)

getRealm

public Realm getRealm()

getRoles

public String[] getRoles()

readPrincipal

public static GenericPrincipal readPrincipal(ObjectInput in, Realm realm)

setRealm

public void setRealm(Realm realm)

toString

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

writePrincipal

public static void writePrincipal(GenericPrincipal p, ObjectOutput out)
Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.