atg.security
Class AliasedPersona

java.lang.Object
  extended by atg.security.AliasedPersona
All Implemented Interfaces:
Persona, java.io.Serializable, java.security.Principal

public class AliasedPersona
extends java.lang.Object
implements Persona, java.io.Serializable

A persona that wraps another persona. This is typically used by a user authority that is acting as a proxy for another user authority, providing a special namespace, e.g. atg.userdirectory.UserDirectoryLoginUserAuthority.

The really important part of this is that getUserAuthority() must return the user authority that actually created this persona so that PersonaAdapter.hasRole() will look up the role in the same namespace from which the persona was created.

See Also:
Serialized Form

Field Summary
static java.lang.String CLASS_VERSION
           
 
Constructor Summary
AliasedPersona(java.lang.String pName, UserAuthority pAuthority, Persona pPersona)
          Creates a new persona that is an alias for another persona.
 
Method Summary
 void addSubPersona(Persona newSubPersona)
          Adds a new sub-persona.
 boolean equals(java.lang.Object object)
          Returns true if this persona is equivalent to another.
 java.util.Collection getAccessRights()
          Does actual lookup of sub-persona information.
 java.lang.Object getAttribute(java.lang.String pAttributeName)
          Retrieves the value of a named attribute of the persona's account.
 java.lang.String getName()
          Returns the machine-readable name of the persona, useful for persisting the object.
 Persona getPersona()
          Returns the persona that we're an alias for.
 Persona[] getSubPersonae()
          Returns a list of sub-personae that compose this persona.
 UserAuthority getUserAuthority()
          Returns the authority that manages this persona.
 int hashCode()
           
 boolean hasPersona(Persona persona)
          Returns true if this persona matches or encompasses the indicated persona.
 boolean hasRole(java.lang.String pRoleName)
          Returns true if this persona is or has a sub-persona with the given name.
 void removeSubPersona(Persona oldPersona)
          Removes a sub-persona.
 void setSubPersonae(Persona[] newSubPersonae)
          Changes the list of sub-personae that compose this persona.
 java.lang.String toString()
           
static Persona unalias(Persona persona)
          Returns the root (unaliased) persona for the given persona.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Constructor Detail

AliasedPersona

public AliasedPersona(java.lang.String pName,
                      UserAuthority pAuthority,
                      Persona pPersona)
Creates a new persona that is an alias for another persona.

Method Detail

getPersona

public Persona getPersona()
Returns the persona that we're an alias for.


unalias

public static Persona unalias(Persona persona)
Returns the root (unaliased) persona for the given persona.


equals

public boolean equals(java.lang.Object object)
Description copied from interface: Persona
Returns true if this persona is equivalent to another.

Specified by:
equals in interface Persona
Specified by:
equals in interface java.security.Principal
Overrides:
equals in class java.lang.Object

hashCode

public int hashCode()
Specified by:
hashCode in interface java.security.Principal
Overrides:
hashCode in class java.lang.Object

toString

public java.lang.String toString()
Specified by:
toString in interface java.security.Principal
Overrides:
toString in class java.lang.Object

getName

public java.lang.String getName()
Returns the machine-readable name of the persona, useful for persisting the object.

Specified by:
getName in interface Persona
Specified by:
getName in interface java.security.Principal

getUserAuthority

public UserAuthority getUserAuthority()
Returns the authority that manages this persona.

Specified by:
getUserAuthority in interface Persona

hasPersona

public boolean hasPersona(Persona persona)
Returns true if this persona matches or encompasses the indicated persona.

Specified by:
hasPersona in interface Persona

getSubPersonae

public Persona[] getSubPersonae()
Returns a list of sub-personae that compose this persona. Note that these might not be aliased.

Specified by:
getSubPersonae in interface Persona

setSubPersonae

public void setSubPersonae(Persona[] newSubPersonae)
                    throws InvalidPersonaException
Changes the list of sub-personae that compose this persona. This feature is not supported for aliases.

Specified by:
setSubPersonae in interface Persona
Throws:
InvalidPersonaException

addSubPersona

public void addSubPersona(Persona newSubPersona)
                   throws InvalidPersonaException
Adds a new sub-persona. This feature is not supported for aliases.

Specified by:
addSubPersona in interface Persona
Throws:
InvalidPersonaException

removeSubPersona

public void removeSubPersona(Persona oldPersona)
Removes a sub-persona. This feature is not supported for aliases.

Specified by:
removeSubPersona in interface Persona
Throws:
InvalidPersonaException

getAttribute

public java.lang.Object getAttribute(java.lang.String pAttributeName)
Retrieves the value of a named attribute of the persona's account. This is a general escape hatch for passing information between the account database and the security domain and is primarily used to allow the security domain to determine the default ACL to use when creating secured resources.

Specified by:
getAttribute in interface Persona
See Also:
SecurityDomain.createResource(java.lang.Object, java.lang.Object, atg.security.AccessControlEntry[])

hasRole

public boolean hasRole(java.lang.String pRoleName)
Returns true if this persona is or has a sub-persona with the given name.

Specified by:
hasRole in interface Persona

getAccessRights

public java.util.Collection getAccessRights()
Does actual lookup of sub-persona information.

Specified by:
getAccessRights in interface Persona