Class AuthenticationEventManager


  • public class AuthenticationEventManager
    extends java.lang.Object
    Provides utility methods to manage LoginEvent.
    Since:
    jcms-10.0.3 / JCMS-6281
    See Also:
    LoginEvent
    • Constructor Detail

      • AuthenticationEventManager

        public AuthenticationEventManager()
    • Method Detail

      • createLoginEvent

        public static final LoginEvent createLoginEvent​(Member member,
                                                        java.util.Date date)
        Create a new LoginEvent in the db for the specified information
        Parameters:
        member - the member for which event is created
        date - the login date to be recorded (create time is used if null specified)
        Returns:
        a new LoginEvent instance
      • getLastLoginEvent

        public static final LoginEvent getLastLoginEvent​(Member member)
        Retrieve the last LoginEvent of the specified member
        Parameters:
        member - the Member for which the LoginEvent must be retrieved (must not be null, otherwise null is return)
        Returns:
        an LoginEvent or null if none could be found
      • getAllLoginEvents

        public static final java.util.List<LoginEvent> getAllLoginEvents​(Member member)
        Retrieve all LoginEvent of the specified member.
        Parameters:
        member - the Member for which the LoginEvent must be retrieved (must not be null, otherwise empty list is return)
        Returns:
        a list of LoginEvent, never return null
      • deleteOldestLoginEvents

        public static void deleteOldestLoginEvents​(Member member,
                                                   int numberOfEventToKeep)
        Delete oldest LoginEvents of the specified member, keeping only the number of event specified.
        Parameters:
        member - the Member for which the old LoginEvent are to be deleted (must not be null, otherwise nothing is performed)
        numberOfEventToKeep - the number of event to keep (wow no kidding ! that's a really helpful javadoc :p)
      • migrateLastLoginDateFromExtraDBDataToLoginEvent

        public static void migrateLastLoginDateFromExtraDBDataToLoginEvent()
        Migrate all existing Member's ExtraDBData previously used to store login date, into new LoginEvent objects.

        Processes performed by this method can be disabled with the following property : member.migrate-last-login-date: false

        This method will starts its own transaction.