com.sun.identity.idm
Class AMIdentity

java.lang.Object
  |
  +--com.sun.identity.idm.AMIdentity

public final class AMIdentity
extends java.lang.Object

This class represents an Identity which needs to be managed by Access Manager. This identity could exist in multiple repositories, which are configured for a given realm or organization. When any operation is performed from this class, it executes all plugins that are configured for performing that operation. For eg: getAttributes. This class does not have public constructors. The application gets access to AMIdentity objects by using AMIdentityRepository interfaces. For example:

    AMIdentityRepository idrepo = new AMIdentityRepository(token, org);
    AMIdentity id = idrepo.getIdentity();
 
The id returned above is the AMIdentity object of the user's single sign-on token passed above. The results obtained from search performed using AMIdentityRepository also return AMIdentity objects. The type of an object can be determined by doing the following:

     IdType type = identity.getType();
 
The name of an object can be determined by:

     String name = identity.getName();
 


Constructor Summary
AMIdentity()
           
 
Method Summary
 void addMember(AMIdentity identity)
          If membership is supported then add the new identity as a member.
 void assignService(java.lang.String serviceName, java.util.Map attributes)
          Assigns the service and service related attributes to the identity.
 boolean equals(java.lang.Object o)
          Overrides the default "equal" method.
 java.util.Set getAssignableServices()
          Returns all services which can be assigned to this entity.
 java.util.Set getAssignedServices()
          Returns the set of services already assigned to this identity.
 java.util.Set getAttribute(java.lang.String attrName)
          Returns the values of the requested attribute.
 java.util.Map getAttributes()
          Returns all attributes and values of this identity.
 java.util.Map getAttributes(java.util.Set attrNames)
          Returns requested attributes and values of this object.
 java.util.Map getBinaryAttributes(java.util.Set attrNames)
          Returns requested attributes and values of this object.
 java.util.Set getMembers(IdType mtype)
          Return all members of a given identity type of this identity as a Set of AMIdentity objects
 java.util.Set getMemberships(IdType mtype)
          Returns the set of identities that this identity belongs to.
 java.lang.String getName()
          Returns the name of the identity.
 java.util.Map getServiceAttributes(java.lang.String serviceName)
          Returns attributes related to a service, if the service is assigned to the identity.
 IdType getType()
          Returns the Type of the Identity.
 boolean isActive()
          If there is a status attribute configured, then verifies if the identity is active and returns true.
 boolean isMember(AMIdentity identity)
          Verifies if this identity is a member of the identity being passed.
 void modifyService(java.lang.String serviceName, java.util.Map attrMap)
          Set attributes related to a specific service.
 void removeAttributes(java.util.Set attrNames)
          Removes the attributes from the identity entry.
 void removeMember(AMIdentity identity)
          Removes the identity from this identity's membership.
 void removeMembers(java.util.Set identityObjects)
          Removes the identities from this identity's membership.
 void setAttributes(java.util.Map attrMap)
          Set the values of attributes.
 void setBinaryAttributes(java.util.Map attrMap)
          Set the values of binary attributes.
 void store()
          Stores the attributes of the object.
 void unassignService(java.lang.String serviceName)
          Removes a service from the identity.
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AMIdentity

public AMIdentity()
Method Detail

getName

public java.lang.String getName()
Returns the name of the identity.
Returns:
Name of the identity

getType

public IdType getType()
Returns the Type of the Identity.
Returns:
IdType representing the type of this object.

isActive

public boolean isActive()
                 throws IdRepoException,
                        SSOException
If there is a status attribute configured, then verifies if the identity is active and returns true.
Returns:
true if the identity is active or if it is not configured for a status attribute, flase otherwise.
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

getAttributes

public java.util.Map getAttributes()
                            throws IdRepoException,
                                   SSOException
Returns all attributes and values of this identity.
Returns:
Map of attribute-values
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

getAttributes

public java.util.Map getAttributes(java.util.Set attrNames)
                            throws IdRepoException,
                                   SSOException
Returns requested attributes and values of this object.
Parameters:
attrNames - Set of attribute names to be read
Returns:
Map of attribute-values.
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

getBinaryAttributes

public java.util.Map getBinaryAttributes(java.util.Set attrNames)
                                  throws IdRepoException,
                                         SSOException
Returns requested attributes and values of this object.
Parameters:
attrNames - Set of attribute names to be read
Returns:
Map of attribute-values.
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

getAttribute

public java.util.Set getAttribute(java.lang.String attrName)
                           throws IdRepoException,
                                  SSOException
Returns the values of the requested attribute. Returns an empty set, if the attribute is not set in the object.
Parameters:
attrName - Name of attribute
Returns:
Set of attribute values.
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

setAttributes

public void setAttributes(java.util.Map attrMap)
                   throws IdRepoException,
                          SSOException
Set the values of attributes. This method should be followed by the method "store" to commit the changes to the Repository
Parameters:
attrMap - Map of attribute-values to be set in the repository or repositories (if multiple plugins are configured for "edit").
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

setBinaryAttributes

public void setBinaryAttributes(java.util.Map attrMap)
                         throws IdRepoException,
                                SSOException
Set the values of binary attributes. This method should be followed by the method "store" to commit the changes to the Repository
Parameters:
attrMap - Map of attribute-values to be set in the repository or repositories (if multiple plugins are configured for "edit").
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

removeAttributes

public void removeAttributes(java.util.Set attrNames)
                      throws IdRepoException,
                             SSOException
Removes the attributes from the identity entry. This method should be followed by a "store" to commit the changes to the Repository.
Parameters:
attrNames - Set of attribute names to be removed
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If the user's single sign on token is invalid

store

public void store()
           throws IdRepoException,
                  SSOException
Stores the attributes of the object.
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

getAssignedServices

public java.util.Set getAssignedServices()
                                  throws IdRepoException,
                                         SSOException
Returns the set of services already assigned to this identity.
Returns:
Set of serviceNames
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

getAssignableServices

public java.util.Set getAssignableServices()
                                    throws IdRepoException,
                                           SSOException
Returns all services which can be assigned to this entity.
Returns:
Set of service names
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

assignService

public void assignService(java.lang.String serviceName,
                          java.util.Map attributes)
                   throws IdRepoException,
                          SSOException
Assigns the service and service related attributes to the identity.
Parameters:
serviceName - Name of service to be assigned.
attributes - Map of attribute-values
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

unassignService

public void unassignService(java.lang.String serviceName)
                     throws IdRepoException,
                            SSOException
Removes a service from the identity.
Parameters:
serviceName - Name of service to be removed.
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

getServiceAttributes

public java.util.Map getServiceAttributes(java.lang.String serviceName)
                                   throws IdRepoException,
                                          SSOException
Returns attributes related to a service, if the service is assigned to the identity.
Parameters:
serviceName - Name of the service.
Returns:
Map of attribute-values.
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

modifyService

public void modifyService(java.lang.String serviceName,
                          java.util.Map attrMap)
                   throws IdRepoException,
                          SSOException
Set attributes related to a specific service. The assumption is that the service is already assigned to the identity. The attributes for the service are validated against the service schema.
Parameters:
serviceName - Name of the service.
attrMap - Map of attribute-values.
Throws:
IdRepoException - If there are repository related error conditions.
SSOException - If user's single sign on token is invalid.

isMember

public boolean isMember(AMIdentity identity)
                 throws IdRepoException,
                        SSOException
Verifies if this identity is a member of the identity being passed.
Parameters:
identity - AMIdentity to check membership with
Returns:
true if this Identity is a member of the given Identity
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - if user's single sign on token is invalid.

addMember

public void addMember(AMIdentity identity)
               throws IdRepoException,
                      SSOException
If membership is supported then add the new identity as a member.
Parameters:
identity - AMIdentity to be added
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - if user's single sign on token is invalid.

removeMember

public void removeMember(AMIdentity identity)
                  throws IdRepoException,
                         SSOException
Removes the identity from this identity's membership.
Parameters:
identity - AMIdentity to be removed from membership.
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - if user's single sign on token is invalid.

removeMembers

public void removeMembers(java.util.Set identityObjects)
                   throws IdRepoException,
                          SSOException
Removes the identities from this identity's membership.
Parameters:
identityObjects - Set of AMIdentity objects
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - if user's single sign on token is invalid.

getMembers

public java.util.Set getMembers(IdType mtype)
                         throws IdRepoException,
                                SSOException
Return all members of a given identity type of this identity as a Set of AMIdentity objects
Parameters:
mtype - Type of identity objects
Returns:
Set of AMIdentity objects that are members of this object.
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - if user's single sign on token is invalid.

getMemberships

public java.util.Set getMemberships(IdType mtype)
                             throws IdRepoException,
                                    SSOException
Returns the set of identities that this identity belongs to.
Parameters:
type - Type of member identity.
Returns:
Set of AMIdentity objects of the given type that this identity belongs to.
Throws:
IdRepoException - if there are repository related error conditions.
SSOException - if user's single sign on token is invalid.

equals

public boolean equals(java.lang.Object o)
Overrides the default "equal" method.
Overrides:
equals in class java.lang.Object


Copyright 2005 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.