Interface IdentityStore
- All Known Implementing Classes:
AMIdentityRepository
public interface IdentityStore
Represents an identity store in which user/role/group and other identity data is
configured. This interface provides access to methods which will search, create
and delete identities.
-
Method Summary
Modifier and TypeMethodDescriptionint
addEventListener
(IdEventListener listener) Add anIdEventListener
to the pool of listeners.boolean
authenticate
(IdType idType, Callback[] credentials) Non-javadoc, non-public methods Returnstrue
if the data store has successfully authenticated the identity with the provided credentials.boolean
authenticate
(Callback[] credentials) Non-javadoc, non-public methods Returnstrue
if the data store has successfully authenticated the identity with the provided credentials.Create anAMIdentity
object.createWithoutValidatingAttributes
(SSOToken token, IdType type, String name, Map<String, Set<String>> attrs, String orgName) Create a new identity without validating the given attributes.void
deleteIdentity
(AMIdentity identity) Delete anAMIdentity
s.findIdentityByUsername
(String username, IdType type) Searches for the identity using the username.findUserByUsernameOrAlias
(String username, Set<String> userSearchAttributes) Searches for the user using the username, then uses the search attributes if nothing is found.getAllowedIdOperations
(IdType type) Get allowed identity operations.Gets theAMIdentity
of a group with groupname equal to groupName that exists in realm.getIdentity
(String uName) Deprecated.Get the realmAMIdentity
object.Returns the realm for the identity repository.getSpecialIdentities
(SSOToken token, IdType type, String orgName) Return the special identities for this realm for a given type.Get supported identity types.Deprecated.UsesearchForIdentity(IdType, String)
insteadvoid
removeEventListener
(int identifier) Remove anIdEventListener
from the pool of listeners.searchForIdentity
(IdType idType, String idName) Returns theAMIdentity
object for the given type, name and realm.searchIdentities
(IdType type, String pattern, IdSearchControl ctrl) Search for identities of certain types from each plugin and returns a combined result.searchIdentities
(IdType type, org.forgerock.openam.utils.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.searchIdentitiesByUsername
(IdType type, String pattern, IdSearchControl ctrl) Search for a single identity based on the identity of certain types from each plugin.
-
Method Details
-
getSupportedIdTypes
Get supported identity types.- Returns:
- the supported identity types
- Throws:
IdRepoException
- if there are repository related error conditionsSSOException
- if there is an SSO token related error
-
getAllowedIdOperations
Get allowed identity operations.- Parameters:
type
- type of identity being searched for- Returns:
- the allowed identity operations
- Throws:
IdRepoException
- if there are repository related error conditionsSSOException
- if there is an SSO token related error
-
searchIdentities
IdSearchResults searchIdentities(IdType type, String pattern, IdSearchControl ctrl) throws IdRepoException, SSOException Search 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 realmAMIdentity
object can be used to assign and unassign services containing dynamic attributes to this realm.- Parameters:
type
- type of identity being searched forpattern
- the query identity patternctrl
- 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 conditionsSSOException
- if user's single sign on token is invalid- See Also:
-
searchIdentitiesByUsername
IdSearchResults searchIdentitiesByUsername(IdType type, String pattern, IdSearchControl ctrl) throws IdRepoException, SSOException Search for a single identity based on the identity of certain types from each plugin. Callers should fail if multiple identities are returned. Note: The AMIdentity objects representing IdType.REALM can be used for services related operations only. The realmAMIdentity
object can be used to assign and unassign services containing dynamic attributes to this realm.- Parameters:
type
- type of identity being searched forpattern
- the query identity patternctrl
- 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 conditionsSSOException
- if user's single sign on token is invalid- See Also:
-
searchIdentities
IdSearchResults searchIdentities(IdType type, org.forgerock.openam.utils.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 realmAMIdentity
object 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:
-
getRealmIdentity
Get the realmAMIdentity
object.- Returns:
- the realm identity
- Throws:
IdRepoException
- if there are repository related error conditionsSSOException
- if there is an SSO token related error
-
createIdentity
AMIdentity createIdentity(IdType type, String idName, Map<String, Set<String>> attrMap) throws IdRepoException, SSOExceptionCreate anAMIdentity
object.- Parameters:
type
- type of identity being searched foridName
- the id nameattrMap
- the attr map- Returns:
- the am identity
- Throws:
IdRepoException
- if there are repository related error conditionsSSOException
- if there is an SSO token related error
-
deleteIdentity
Delete anAMIdentity
s.- Parameters:
identity
- the identity to delete- Throws:
IdRepoException
- if there are repository related error conditionsSSOException
- if there is an SSO token related error
-
authenticate
Non-javadoc, non-public methods Returnstrue
if 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 theIdRepoException
exception.- Parameters:
credentials
- Array of callback objects containing information such as username and password.- Returns:
true
if data store authenticates the identity; elsefalse
- Throws:
IdRepoException
AuthLoginException
-
authenticate
boolean authenticate(IdType idType, Callback[] credentials) throws IdRepoException, AuthLoginException Non-javadoc, non-public methods Returnstrue
if 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 theIdRepoException
exception.- 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:
true
if data store authenticates the identity; elsefalse
- Throws:
IdRepoException
AuthLoginException
-
addEventListener
Add anIdEventListener
to the pool of listeners.- Parameters:
listener
- the identity event listener to add- Returns:
- the total amount of
IdEventListener
s available
-
removeEventListener
void removeEventListener(int identifier) Remove anIdEventListener
from the pool of listeners.- Parameters:
identifier
- the identifier for theIdEventListener
to be removed
-
getSpecialIdentities
IdSearchResults getSpecialIdentities(SSOToken token, IdType type, String orgName) 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.
-
getRealmName
String getRealmName()Returns the realm for the identity repository.- Returns:
- String representing realm name.
-
getIdentity
Deprecated.UsefindIdentityByUsername(java.lang.String, IdType)
insteadReturns anAMIdentity
object representing the provided username.- Parameters:
uName
- the username of the user to retrieve- Returns:
- identity object or
null
-
getUserUsingAuthenticationUserAliases
Deprecated.UsesearchForIdentity(IdType, String)
insteadReturns anAMIdentity
object representing the provided username, or if no match was found, representing a user matching the authentication user alias list. Note: the intention is that this will be extracted to an authentication specific API in the future- Parameters:
uName
- the username of the user to retrieve- Returns:
- identity object or
null
-
getGroup
Gets theAMIdentity
of a group with groupname equal to groupName that exists in realm. If noAMIdentity
found using groupname it will fall back to using userSearchAttributes if supplied.- Parameters:
groupName
- the name of the group to retrieve- Returns:
- the
AMIdentity
of group with groupname equal to groupName
-
searchForIdentity
Returns theAMIdentity
object for the given type, name and realm.This operation will search the store for the specific identity. If no identity is found that matches the exact search requirements then
Optional.empty()
is returned. -
createWithoutValidatingAttributes
AMIdentity createWithoutValidatingAttributes(SSOToken token, IdType type, String name, Map<String, Set<String>> attrs, String orgName) throws IdRepoException, SSOExceptionCreate a new identity without validating the given attributes. This method should only be used if the attributes has already been validated.- Parameters:
token
- is the sso token of the person performing this operation.type
- The identity type.name
- The identity name.attrs
- The default attributes this identity will be created with.orgName
- Realm in which the identity will be created.- Returns:
- The newly created identity.
- Throws:
IdRepoException
- if there are repository related error conditions.SSOException
- if the sso token is invalid.
-
findIdentityByUsername
Optional<AMIdentity> findIdentityByUsername(String username, IdType type) throws IdRepoException, SSOException Searches for the identity using the username.- Parameters:
username
- The username to search for- Returns:
- An optional containing the identity if one is found, empty otherwise.
- Throws:
IdRepoException
- If an error occurred or more than one result was foundSSOException
- If an error occurred
-
findUserByUsernameOrAlias
Optional<AMIdentity> findUserByUsernameOrAlias(String username, Set<String> userSearchAttributes) throws IdRepoException, SSOException Searches for the user using the username, then uses the search attributes if nothing is found.- Parameters:
username
- The username to search foruserSearchAttributes
- The other attributes to search for the username under- Returns:
- An optional containing the identity if one is found, empty otherwise.
- Throws:
IdRepoException
- If an error occurred or more than one result was foundSSOException
- If an error occurred
-
findIdentityByUsername(java.lang.String, IdType)
instead