org.jasig.portal.security.provider
Class PersonImpl

java.lang.Object
  extended by org.jasig.portal.security.provider.PersonImpl
All Implemented Interfaces:
Serializable, Principal, IBasicEntity, IAdditionalDescriptor, IPerson

public class PersonImpl
extends Object
implements IPerson

This is a reference IPerson implementation.

Version:
$Revision: 19776 $
Author:
Adam Rybicki, arybicki@unicon.net
See Also:
Serialized Form

Field Summary
protected  boolean entityIdentifierSet
           
protected  EntityIdentifier m_eid
           
protected  String m_FullName
           
protected  int m_ID
           
protected  ISecurityContext m_securityContext
           
protected  ConcurrentMap<String,List<Object>> userAttributes
           
 
Fields inherited from interface org.jasig.portal.security.IPerson
GUEST_ID, SYSTEM_USER_ID, UNDEFINED_ID, USERNAME
 
Constructor Summary
PersonImpl()
           
 
Method Summary
 boolean equals(Object obj)
           
 Object getAttribute(String key)
          Returns an attribute for a key.
 Enumeration<String> getAttributeNames()
          Returns an enumeration of all of the attribute names associated with the user
 Enumeration<List<Object>> getAttributes()
          Returns a java.util.Enumeration of all the attribute values.
 Object[] getAttributeValues(String key)
          Returns multiple attributes for a key.
 EntityIdentifier getEntityIdentifier()
          Returns an EntityIdentifier for this person.
 String getFullName()
          Returns the user's name that was established during authentication.
 int getID()
          Returns the user's ID that was used for authentication.
 String getName()
           
 ISecurityContext getSecurityContext()
          Gets the security context object associated with the user
 String getUserName()
           
 int hashCode()
           
 boolean isGuest()
          Determines whether or not this person is a "guest" user.
 void setAttribute(String key, List<Object> value)
           
 void setAttribute(String key, Object value)
          Sets the specified attribute to a value.
 void setAttributes(Map<String,List<Object>> attrs)
          Sets the specified attributes.
 void setEntityIdentifier(EntityIdentifier ei)
          One time set of the entity identifier
 void setFullName(String sFullName)
          Sets the user's full name.
 void setID(int sID)
          Sets the user's ID.
 void setSecurityContext(ISecurityContext securityContext)
          Associates a security context object with the user
 void setUserName(String userName)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

userAttributes

protected ConcurrentMap<String,List<Object>> userAttributes

m_FullName

protected String m_FullName

m_ID

protected int m_ID

m_securityContext

protected ISecurityContext m_securityContext

m_eid

protected EntityIdentifier m_eid

entityIdentifierSet

protected boolean entityIdentifierSet
Constructor Detail

PersonImpl

public PersonImpl()
Method Detail

getSecurityContext

public ISecurityContext getSecurityContext()
Description copied from interface: IPerson
Gets the security context object associated with the user

Specified by:
getSecurityContext in interface IPerson
Returns:
security context object associated with the user

setSecurityContext

public void setSecurityContext(ISecurityContext securityContext)
Description copied from interface: IPerson
Associates a security context object with the user

Specified by:
setSecurityContext in interface IPerson

getAttribute

public Object getAttribute(String key)
Returns an attribute for a key. For objects represented as strings, a java.lang.String will be returned. Binary values will be represented as byte arrays.

Specified by:
getAttribute in interface IPerson
Parameters:
key - the attribute name.
Returns:
value the attribute value identified by the key.

getAttributeValues

public Object[] getAttributeValues(String key)
Returns multiple attributes for a key. If only one value exists, it will be returned in an array of size one.

Specified by:
getAttributeValues in interface IPerson
Parameters:
key - the attribute name
Returns:
the array of attribute values identified by the key

getAttributes

public Enumeration<List<Object>> getAttributes()
Returns a java.util.Enumeration of all the attribute values.

Specified by:
getAttributes in interface IPerson
Returns:
java.util.Enumeration of the attributes.

getAttributeNames

public Enumeration<String> getAttributeNames()
Returns an enumeration of all of the attribute names associated with the user

Specified by:
getAttributeNames in interface IPerson
Returns:
enumeration of all of the attribute names associated with the user

setAttribute

public void setAttribute(String key,
                         Object value)
Sets the specified attribute to a value. Reference impementation checks for the setting of the username attribute and updates the EntityIdentifier accordingly

Specified by:
setAttribute in interface IPerson
Parameters:
key - Attribute's name
value - Attribute's value

setAttribute

public void setAttribute(String key,
                         List<Object> value)
Specified by:
setAttribute in interface IPerson

setAttributes

public void setAttributes(Map<String,List<Object>> attrs)
Sets the specified attributes. Uses setAttribute(String, Object) to set each.

Specified by:
setAttributes in interface IPerson
See Also:
IPerson.setAttributes(java.util.Map)

getID

public int getID()
Returns the user's ID that was used for authentication. Does not correlate to any eduPerson attribute but is the key for user data in uPortal reference rdbms.

Specified by:
getID in interface IPerson
Returns:
User's ID.

setID

public void setID(int sID)
Sets the user's ID.

Specified by:
setID in interface IPerson
Parameters:
sID - User's ID as supplied for authentication Does not correlate to any eduPerson attribute but is the key for user data in uPortal reference rdbms.

getUserName

public String getUserName()
Specified by:
getUserName in interface IPerson
Returns:
The userName for the user.

setUserName

public void setUserName(String userName)
Specified by:
setUserName in interface IPerson
Parameters:
userName - The userName to set for the user.

getFullName

public String getFullName()
Returns the user's name that was established during authentication. Correlates to cn (common name) in the eduPerson 1.0 specification.

Specified by:
getFullName in interface IPerson
Returns:
User's name.

setFullName

public void setFullName(String sFullName)
Sets the user's full name.

Specified by:
setFullName in interface IPerson
Parameters:
sFullName - User's name as established during authentication Correlates to cn (common name) in the eduPerson 1.0 specification.

isGuest

public boolean isGuest()
Determines whether or not this person is a "guest" user.

This person is a "guest" if both of the following are true:

  1. This person has not successfully authenticated with the portal.
  2. This person's user name matches the value of the property org.jasig.portal.security.PersonImpl.guest_user_name in portal.properties.

Specified by:
isGuest in interface IPerson
Returns:
true if person is a guest, otherwise false

getEntityIdentifier

public EntityIdentifier getEntityIdentifier()
Returns an EntityIdentifier for this person. The key contains the value of the eudPerson username attribute, or null

Specified by:
getEntityIdentifier in interface IBasicEntity
Returns:
EntityIdentifier with attribute 'username' as key.

setEntityIdentifier

public void setEntityIdentifier(EntityIdentifier ei)
One time set of the entity identifier

Specified by:
setEntityIdentifier in interface IPerson
Parameters:
ei -

getName

public String getName()
Specified by:
getName in interface Principal

toString

public String toString()
Specified by:
toString in interface Principal
Overrides:
toString in class Object

hashCode

public int hashCode()
Specified by:
hashCode in interface Principal
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Specified by:
equals in interface Principal
Overrides:
equals in class Object


Copyright © 2010 Jasig. All Rights Reserved.