Package com.sun.identity.idm
Class AMIdentityRepository
- java.lang.Object
-
- com.sun.identity.idm.AMIdentityRepository
-
public class AMIdentityRepository extends Object
The classAMIdentityRepositoryrepresents an object to access the repositories in which user/role/group and other identity data is configured. This class provides access to methods which will search, create and delete identities. An instance of this class can be obtained in the following manner:AMIdentityRepository idRepo = new AMIdentityRepository(ssoToken, realmName);
-
-
Constructor Summary
Constructors Constructor Description AMIdentityRepository(SSOToken ssotoken, String realmName)Deprecated.in 13.0.0, useAMIdentityRepository(String, com.iplanet.sso.SSOToken)insteadAMIdentityRepository(String realmName, SSOToken ssoToken)Constructor for theAMIdentityRepositoryobject.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static voidaddCreationListener(IdRepoCreationListener listener)Adds a creation listener that will be notified each time aAMIdentityRepositoryis created .intaddEventListener(IdEventListener listener)Adds a listener, which should receive notifications for all changes that occurred in this organization.booleanauthenticate(IdType idType, Callback[] credentials)Non-javadoc, non-public methods Returnstrueif the data store has successfully authenticated the identity with the provided credentials.booleanauthenticate(Callback[] credentials)Non-javadoc, non-public methods Returnstrueif the data store has successfully authenticated the identity with the provided credentials.static voidclearCache()Clears the cache.SetcreateIdentities(IdType type, Map identityNamesAndAttrs)Creates multiple objects of the same type.AMIdentitycreateIdentity(IdType type, String idName, Map attrMap)Creates a single object of a type.voiddeleteIdentities(IdType type, Set identities)Deprecated.As of release AM 7.1, replaced bydeleteIdentities(Set)voiddeleteIdentities(Set identities)Deletes identities.SetgetAllowedIdOperations(IdType type)Returns the set of Operations for a givenIdType,IdOperationsthat can be performed on an Identity.AMIdentitygetRealmIdentity()Returns a handle of the Identity object representing this realm for services related operations only.IdSearchResultsgetSpecialIdentities(SSOToken token, IdType type, String orgName)IdSearchResultsgetSpecialIdentities(IdType type)Return the special identities for this realm for a given type.SetgetSupportedIdTypes()Returns the set of supported object typesIdTypefor this deployment.static booleanremoveCreationListener(IdRepoCreationListener listener)Removes a creation listener so that it will no longer be notified when aAMIdentityRepositoryis created.voidremoveEventListener(int identifier)Removes listener as the application is no longer interested in receiving notifications.IdSearchResultssearchIdentities(IdType type, String pattern, IdSearchControl ctrl)Searches for identities of certain types from each plugin and returns a combined result.IdSearchResultssearchIdentities(IdType type, String pattern, Map avPairs, boolean recursive, int maxResults, int maxTime, Set returnAttributes, boolean returnAllAttributes)Deprecated.This method is deprecated.IdSearchResultssearchIdentities(IdType type, CrestQuery crestQuery, IdSearchControl ctrl)Searches for identities of certain types from each plugin and returns a combined result Note: The AMIdentity objects representing IdType.REALM can be used for services related operations only.StringtoString()Return String representation of theAMIdentityRepositoryobject.
-
-
-
Constructor Detail
-
AMIdentityRepository
@Deprecated public AMIdentityRepository(SSOToken ssotoken, String realmName) throws IdRepoException, SSOException
Deprecated.in 13.0.0, useAMIdentityRepository(String, com.iplanet.sso.SSOToken)insteadConstructor for theAMIdentityRepositoryobject. If a null is passed for the organization identifierrealmName, then the "root" realm is assumed.- Parameters:
ssotoken- Single sign on token of the userrealmName- Name of the realm (can be a Fully qualified DN)- Throws:
IdRepoException- Never thrown, required by legacy code.SSOException- Never thrown, required by legacy code.
-
AMIdentityRepository
@Inject public AMIdentityRepository(@Nullable String realmName, SSOToken ssoToken)
Constructor for theAMIdentityRepositoryobject. If anullis passed for the organization identifierrealmName, then the "root" realm is assumed.- Parameters:
ssoToken- Single sign on token of the user.realmName- Name of the realm (can be a Fully qualified DN).
-
-
Method Detail
-
addCreationListener
public static void addCreationListener(IdRepoCreationListener listener)
Adds a creation listener that will be notified each time aAMIdentityRepositoryis created .- Parameters:
listener- The listener.
-
removeCreationListener
public static boolean removeCreationListener(IdRepoCreationListener listener)
Removes a creation listener so that it will no longer be notified when aAMIdentityRepositoryis created.- Parameters:
listener- The listener.- Returns:
trueif the listener was removed.
-
getSupportedIdTypes
public Set getSupportedIdTypes() throws IdRepoException, SSOException
Returns the set of supported object typesIdTypefor this deployment. This is not realm specific.- Returns:
- Set of supported
IdTypeobjects. - Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.
-
getAllowedIdOperations
public Set getAllowedIdOperations(IdType type) throws IdRepoException, SSOException
Returns the set of Operations for a givenIdType,IdOperationsthat can be performed on an Identity. This varies for each organization (and each plugin?).- Parameters:
type- Type of identity- Returns:
- Set of
IdOperationobjects. - Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.
-
getSpecialIdentities
public IdSearchResults getSpecialIdentities(IdType type) throws IdRepoException, SSOException
Return the special identities for this realm for a given type. These identities cannot be deleted and hence have to be shown in the admin console as non-deletable.- Parameters:
type- Type of the identity- Returns:
- IdSearchResult
- Throws:
IdRepoException- if there is a datastore exceptionSSOException- if the user's single sign on token is not valid.
-
searchIdentities
public IdSearchResults searchIdentities(IdType type, String pattern, Map avPairs, boolean recursive, int maxResults, int maxTime, Set returnAttributes, boolean returnAllAttributes) throws IdRepoException, SSOException
Deprecated.This method is deprecated. UsesearchIdentities(IdType type,String pattern, IdSearchControl ctrl)Searches for identities of a certain type. The iterator returns AMIdentity objects for use by the application.- Parameters:
type- Type of identity being searched for.pattern- Search pattern, like "a*" or "*".avPairs- Map of attribute-values which can further help qualify the search pattern.recursive- If true, then the search is performed on the entire subtree (if applicable)maxResults- Maximum number of results to be returned. A -1 means no limit on the result set.maxTime- Maximum amount of time after which the search should return with partial results.returnAttributes- Set of attributes to be read when performing the search.returnAllAttributes- If true, then read all the attributes of the entries.- Returns:
- results containing
AMIdentityobjects. - Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.
-
searchIdentities
public IdSearchResults searchIdentities(IdType type, String pattern, IdSearchControl ctrl) throws IdRepoException, SSOException
Searches for identities of certain types from each plugin and returns a combined result. Note: The AMIdentity objects representing IdType.REALM can be used for services related operations only. The realmAMIdentityobject can be used to assign and unassign services containing dynamic attributes to this realm.- Parameters:
type- Type of identity being searched for.pattern- Pattern to be used when searching.ctrl- IdSearchControl which can be used to set up various search controls on the search to be performed.- Returns:
- Returns the combined results in an object IdSearchResults.
- Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.- See Also:
IdSearchControl,IdSearchResults
-
searchIdentities
public IdSearchResults searchIdentities(IdType type, CrestQuery crestQuery, IdSearchControl ctrl) throws IdRepoException, SSOException
Searches for identities of certain types from each plugin and returns a combined result Note: The AMIdentity objects representing IdType.REALM can be used for services related operations only. The realmAMIdentityobject can be used to assign and unassign services containing dynamic attributes to this realm.- Parameters:
type- Type of identity being searched for.crestQuery- Basically just an object which supports both _queryId and _queryFilterctrl- IdSearchControl which can be used to set up various search controls on the search to be performed.- Returns:
- Returns the combined results in an object IdSearchResults.
- Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.- See Also:
IdSearchControl,IdSearchResults
-
getRealmIdentity
public AMIdentity getRealmIdentity() throws IdRepoException, SSOException
Returns a handle of the Identity object representing this realm for services related operations only. ThisAMIdentityobject can be used to assign and unassign services containing dynamic attributes to this realm- Returns:
- a handle of the Identity object.
- Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.
-
createIdentity
public AMIdentity createIdentity(IdType type, String idName, Map attrMap) throws IdRepoException, SSOException
Creates a single object of a type. The object is created in all the plugins that support creation of this type of object. This method is only valid for:
Note: For creatingIdType.REALMidentities, a map ofsunIdentityRepositoryServiceattributes need to be passed. Also, AMIdentity object representing this realm can be used for services related operations only. ThisAMIdentityobject can be used to assign and unassign services containing dynamic attributes to this realm- Parameters:
type-IdTypeof object to be created.idName- Name of object. If the type isIdType.REALMthen enter a valid realm name.attrMap- Map of attribute-values to be set when creating the entry.- Returns:
- Identity object representing the newly created entry.
- Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.
-
createIdentities
public Set createIdentities(IdType type, Map identityNamesAndAttrs) throws IdRepoException, SSOException
Creates multiple objects of the same type. The objects are created in all theIdRepoplugins that support creation of these objects. This method is only valid for:-
IdType.AGENT - (@link IdType#USER IdType.USER}
-
IdType.REALM
Note: For creatingIdType.REALMidentities, a map ofsunIdentityRepositoryServiceattributes need to be passed. Also, AMIdentity object representing this realm can be used for services related operations only. ThisAMIdentityobject can be used to assign and unassign services containing dynamic attributes to this realm.- Parameters:
type- Type of object to be createdidentityNamesAndAttrs- Names of the identities and their- Returns:
- Set of created Identities.
- Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.
-
-
deleteIdentities
public void deleteIdentities(IdType type, Set identities) throws IdRepoException, SSOException
Deprecated.As of release AM 7.1, replaced bydeleteIdentities(Set)Deletes identities. The Set passed is a set ofAMIdentityobjects. This method is only valid for:-
IdType.AGENT -
IdType.REALM - (@link IdType#USER IdType.USER}
- Parameters:
type- Type of Identity to be deleted.identities- Set ofAMIdentityobjects to be deleted.- Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.
-
-
deleteIdentities
public void deleteIdentities(Set identities) throws IdRepoException, SSOException
Deletes identities. The Set passed is a set ofAMIdentityobjects. This method is only valid for:-
IdType.AGENT -
IdType.REALM - (@link IdType#USER IdType.USER}
- Parameters:
identities- Set ofAMIdentityobjects to be deleted- Throws:
IdRepoException- if there are repository related error conditions.SSOException- if user's single sign on token is invalid.
-
-
authenticate
public boolean authenticate(Callback[] credentials) throws IdRepoException, AuthLoginException
Non-javadoc, non-public methods Returnstrueif the data store has successfully authenticated the identity with the provided credentials. In case the data store requires additional credentials, the list would be returned via theIdRepoExceptionexception.- Parameters:
credentials- Array of callback objects containing information such as username and password.- Returns:
trueif data store authenticates the identity; elsefalse- Throws:
IdRepoExceptionAuthLoginException
-
authenticate
public boolean authenticate(IdType idType, Callback[] credentials) throws IdRepoException, AuthLoginException
Non-javadoc, non-public methods Returnstrueif the data store has successfully authenticated the identity with the provided credentials. In case the data store requires additional credentials, the list would be returned via theIdRepoExceptionexception.- Parameters:
credentials- Array of callback objects containing information such as username and password.idType- The type of identity to authenticate as, or null for any.- Returns:
trueif data store authenticates the identity; elsefalse- Throws:
IdRepoExceptionAuthLoginException
-
addEventListener
public int addEventListener(IdEventListener listener)
Adds a listener, which should receive notifications for all changes that occurred in this organization. This method is only valid for IdType User and Agent.- Parameters:
listener- The callback which implementsAMEventListener.- Returns:
- Integer identifier for this listener.
-
removeEventListener
public void removeEventListener(int identifier)
Removes listener as the application is no longer interested in receiving notifications.- Parameters:
identifier- Integer identifying the listener.
-
clearCache
public static void clearCache()
Clears the cache.
-
getSpecialIdentities
public IdSearchResults getSpecialIdentities(SSOToken token, IdType type, String orgName) throws IdRepoException, SSOException
- Throws:
IdRepoExceptionSSOException
-
-