Interface IdentityManager


  • public interface IdentityManager
    Provides APIs to manage identities. APIs provide capability of getting, creating or updating identities and profile information.

    One identity is got by Id and allows the profile to be loaded or not. With a list of identities, the type of returned result is ListAccess which is used for lazy loading. Also, the API which adds or removes the provider information is provided.
    • Field Detail

      • DEFAULT_SORTING

        static final Sorting DEFAULT_SORTING
      • DEFAULT_FIRST_CHAR_FILTERING

        static final String DEFAULT_FIRST_CHAR_FILTERING
    • Method Detail

      • getLastIdentities

        List<Identity> getLastIdentities​(int limit)
        Gets the last identities that have been created.
        Parameters:
        limit - the limit of identities to provide.
        Returns:
        The last identities.
        Since:
        4.0.x
        eXo level API
        Experimental
      • getOrCreateIdentity

        Identity getOrCreateIdentity​(String providerId,
                                     String remoteId,
                                     boolean isProfileLoaded)
        Deprecated.
        Use getOrCreateIdentity(String, String) instead. * Will be moved by 6.0.x.
        Gets or creates an identity provided by an identity provider and an identity Id.
        Parameters:
        providerId - Id of the identity provider.
        remoteId - The user remote Id.
        isProfileLoaded - Is profile loaded or not.
        Returns:
        The identity.
        eXo level API
        Platform
      • getIdentity

        Identity getIdentity​(String identityId,
                             boolean isProfileLoaded)
        Deprecated.
        Use getIdentity(String) instead.
        Gets an identity by a given Id. This Id is UUID defined by storage.
        Parameters:
        identityId - Id of the identity.
        isProfileLoaded - Is profile loaded or not.
        Returns:
        The identity.
        eXo level API
        Platform
      • updateIdentity

        Identity updateIdentity​(Identity identity)
        Updates specific properties of an identity.
        Parameters:
        identity - The identity.
        Returns:
        The updated identity.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • deleteIdentity

        void deleteIdentity​(Identity identity)
        Deletes an identity.
        Parameters:
        identity - The identity to be deleted.
        eXo level API
        Platform
      • hardDeleteIdentity

        void hardDeleteIdentity​(Identity identity)
        Cleans all data related to a specific identity.
        Parameters:
        identity - The identity whose all data is cleaned.
        eXo level API
        Platform
      • getConnectionsWithListAccess

        org.exoplatform.commons.utils.ListAccess<Identity> getConnectionsWithListAccess​(Identity identity)
        Gets a list access which contains all identities connected to the provided identity. The type of returned result is ListAccess which can be lazy loaded.
        Parameters:
        identity - The provided identity.
        Returns:
        The identities which have connected to the provided identity.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getProfile

        Profile getProfile​(Identity identity)
        Gets a profile associated with a provided identity.
        Parameters:
        identity - The provided identity.
        Returns:
        The profile.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getAvatarInputStream

        InputStream getAvatarInputStream​(Identity identity)
                                  throws IOException
        Gets a profile avatar associated with a provided identity
        Parameters:
        identity -
        Returns:
        Throws:
        IOException
      • getBannerInputStream

        InputStream getBannerInputStream​(Identity identity)
                                  throws IOException
        Gets a profile banner associated with a provided identity
        Parameters:
        identity -
        Returns:
        Throws:
        IOException
      • updateProfile

        void updateProfile​(Profile specificProfile)
        Updates a specific profile.
        Parameters:
        specificProfile - The specific profile.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • updateProfile

        default void updateProfile​(Profile specificProfile,
                                   boolean broadcastChanges)
        Updates a specific profile and broadcast detected changes on profile if 'broadcastChanges' is turned on
        Parameters:
        specificProfile - The specific profile.
        broadcastChanges - whether detect and broadcast changed fields or not
      • getIdentitiesByProfileFilter

        org.exoplatform.commons.utils.ListAccess<Identity> getIdentitiesByProfileFilter​(String providerId,
                                                                                        ProfileFilter profileFilter,
                                                                                        boolean isProfileLoaded)
        Gets a list access which contains all identities from a given provider. These identities are filtered by the profile filter. The type of returned result is ListAccess which can be lazy loaded.
        Parameters:
        providerId - Id of the provider.
        profileFilter - The filter.
        isProfileLoaded - Is profile loaded or not.
        Returns:
        The identities.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • getIdentitiesForUnifiedSearch

        org.exoplatform.commons.utils.ListAccess<Identity> getIdentitiesForUnifiedSearch​(String providerId,
                                                                                         ProfileFilter profileFilter)
        Gets a list access which contains identities matching with the Unified Search condition.
        Parameters:
        providerId - Id of the provider.
        profileFilter - The filter.
        Returns:
        The identities.
        Since:
        4.0.x
      • getSpaceIdentityByProfileFilter

        org.exoplatform.commons.utils.ListAccess<Identity> getSpaceIdentityByProfileFilter​(Space space,
                                                                                           ProfileFilter profileFilter,
                                                                                           SpaceMemberFilterListAccess.Type type,
                                                                                           boolean isProfileLoaded)
        Gets space identities by filter information. The type of returned result is ListAccess which can be lazy loaded.
        Parameters:
        space - The space in which identities are got.
        profileFilter - The filter information.
        type - Type of identities to find.
        isProfileLoaded - Is profile loaded or not.
        Returns:
        The space identities.
        eXo level API
        Platform
      • addIdentityProvider

        void addIdentityProvider​(IdentityProvider<?> identityProvider)
        Adds an identity provider to an identity manager.
        Parameters:
        identityProvider - The identity provider.
        eXo level API
        Platform
      • removeIdentityProvider

        void removeIdentityProvider​(IdentityProvider<?> identityProvider)
        Removes a specific identity provider.
        Parameters:
        identityProvider - The specific identity provider.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • registerProfileListener

        void registerProfileListener​(ProfileListenerPlugin profileListenerPlugin)
        Registers a profile listener plugin by an external component plugin mechanism. For example:

          <external-component-plugins>
            <target-component>org.exoplatform.social.core.manager.IdentityManager</target-component>
            <component-plugin>
              <name>ProfileUpdatesPublisher</name>
              <set-method>registerProfileListener</set-method>
              <type>org.exoplatform.social.core.application.ProfileUpdatesPublisher</type>
            </component-plugin>
          </external-component-plugins>
        
        Parameters:
        profileListenerPlugin - The profile listener plugin.
        Since:
        1.2.0-GA
        eXo level API
        Platform
      • registerIdentityProviders

        void registerIdentityProviders​(IdentityProviderPlugin plugin)
        Registers one or more identity providers through IdentityProviderPlugin.
        Parameters:
        plugin - The identity provider plugin.
        eXo level API
        Platform
      • processEnabledIdentity

        void processEnabledIdentity​(String remoteId,
                                    boolean isEnable)
        Process status of Identity when enable/disable user.
        Parameters:
        remoteId - The user remote id
        isEnable - true if the user is enable, false if not
        Since:
        4.1.x
        eXo level API
        Platform
      • getIdentity

        Identity getIdentity​(String id)
        Gets an identity by Id and also loads his profile.
        Parameters:
        id - Id of a Social identity (such as GlobalId) or a raw identity (such as Identity.getId()).
        Returns:
        Null if nothing is found, or the Identity object.
        See Also:
        getIdentity(String, boolean)
        eXo level API
        Provisional
      • getOrCreateIdentity

        Identity getOrCreateIdentity​(String providerId,
                                     String remoteId)
        Gets an identity by a remote Id.
        Parameters:
        providerId - Id of the provider.
        remoteId - The remote Id.
        Returns:
        The identity.
        eXo level API
        Provisional
      • getIdentitiesCount

        long getIdentitiesCount​(String providerId)
        Deprecated.
        Will be removed by 4.0.x.
        Gets a count of identities.
        Returns:
        The count of identities.
        eXo level API
        Provisional
      • identityExisted

        boolean identityExisted​(String providerId,
                                String remoteId)
        Checks if an identity has already existed or not.
        Parameters:
        providerId - Id of the provider.
        remoteId - The remote Id.
        Returns:
        "True" if the checked identity has already existed. Otherwise, it returns "false".
        eXo level API
        Provisional
      • addOrModifyProfileProperties

        void addOrModifyProfileProperties​(Profile profile)
                                   throws Exception
        Deprecated.
        Will be removed by 4.0.x.
        Adds or modifies properties of a profile. The profile parameter is lightweight that contains only the property you want to add or modify. NOTE: The method will not delete properties from the old profile when the param profile has not those keys.
        Parameters:
        profile - The identity profile containing information which is added or modified.
        Throws:
        Exception
        eXo level API
        Provisional
      • updateAvatar

        void updateAvatar​(Profile p)
        Deprecated.
        Will be removed by 4.0.x.
        Updates an avatar.
        Parameters:
        p - The profile containing its avatar which is updated.
        Throws:
        MessageException
        eXo level API
        Provisional
      • updateBasicInfo

        void updateBasicInfo​(Profile p)
                      throws Exception
        Deprecated.
        Will be removed by 4.0.x.
        Updates the basic information.
        Parameters:
        p - The profile containing its basic information which is updated.
        Throws:
        Exception
        eXo level API
        Provisional
      • updateContactSection

        void updateContactSection​(Profile p)
                           throws Exception
        Deprecated.
        Will be removed by 4.0.x.
        Updates the contact section of a profile.
        Parameters:
        p - The profile containing its contact section which is updated.
        Throws:
        Exception
        eXo level API
        Provisional
      • updateExperienceSection

        void updateExperienceSection​(Profile p)
                              throws Exception
        Deprecated.
        Will be removed by 4.0.x.
        Updates the experience section of a profile.
        Parameters:
        p - The profile containing the experience section which is updated.
        Throws:
        Exception
        eXo level API
        Provisional
      • updateHeaderSection

        void updateHeaderSection​(Profile p)
                          throws Exception
        Deprecated.
        Will be removed by 4.0.x.
        Updates the header section of profile.
        Parameters:
        p - The profile containing the header section which is updated.
        Throws:
        Exception
        eXo level API
        Provisional
      • getIdentities

        List<Identity> getIdentities​(String providerId,
                                     boolean loadProfile)
                              throws Exception
        Deprecated.
        Use getIdentities(String, boolean) instead. Will be removed by 4.0.x.
        Gets all identities from a provider Id.
        Parameters:
        providerId - Id of the provider.
        loadProfile - The load profile.
        Returns:
        The identities.
        Throws:
        Exception
        eXo level API
        Provisional
      • getIdentityStorage

        IdentityStorage getIdentityStorage()
        Deprecated.
        Will be removed by 4.0.x.
        Gets the identity storage.
        Returns:
        The identity storage.
        eXo level API
        Provisional
      • getStorage

        IdentityStorage getStorage()
        Deprecated.
        Will be removed by 4.0.x.
        Gets the identity storage.
        Returns:
        The identity storage.
        eXo level API
        Provisional
      • registerProfileListener

        void registerProfileListener​(ProfileListener listener)
        Deprecated.
        Will be removed by 4.0.x.
        Registers a profile listener.
        Parameters:
        listener - The profile listener to be registered.
        eXo level API
        Provisional
      • unregisterProfileListener

        void unregisterProfileListener​(ProfileListener listener)
        Deprecated.
        Will be removed by 4.0.x.
        Unregisters a profile listener.
        Parameters:
        listener - The listener to be unregistered.
        eXo level API
        Provisional
      • sortIdentities

        default List<String> sortIdentities​(List<String> identityRemoteIds,
                                            String firstCharacterFieldName,
                                            char firstCharacter,
                                            String sortField,
                                            String sortDirection)
        Sorts a list of user identities using a field
        Parameters:
        identityRemoteIds -
        firstCharacterFieldName -
        firstCharacter -
        sortField -
        sortDirection -
        Returns:
        List of userNames sorted by sortField
      • sortIdentities

        default List<String> sortIdentities​(List<String> identityRemoteIds,
                                            String firstCharacterFieldName,
                                            char firstCharacter,
                                            String sortField,
                                            String sortDirection,
                                            boolean filterDisabled)
        Sorts a list of user identities using a field. Additionally, if filterDisabled is equal to true, only enabled users will be returned
        Parameters:
        identityRemoteIds -
        firstCharacterFieldName -
        firstCharacter -
        sortField -
        sortDirection -
        filterDisabled -
        Returns:
      • getDefaultSorting

        default Sorting getDefaultSorting()
        Returns:
        default sorting to apply when listing
      • getFirstCharacterFiltering

        default String getFirstCharacterFiltering()
        Returns:
        field name to use to filter on first character when listing identities
      • getImageUploadLimit

        default int getImageUploadLimit()
        Returns:
        banner and avatar of identities Max upload size in MB
      • getOrCreateSpaceIdentity

        default Identity getOrCreateSpaceIdentity​(String spacePrettyName)
        Retrieves the identity of a given space identified by its prettyName
        Parameters:
        spacePrettyName - Space prettyName
        Returns:
        Identity if found, else null
      • getOrCreateUserIdentity

        default Identity getOrCreateUserIdentity​(String username)
        Retrieves the identity of a given user identified by his username/login
        Parameters:
        username - login identifier of the user
        Returns:
        Identity if found, else null