Class JpaEventStoreProvider

java.lang.Object
org.keycloak.events.jpa.JpaEventStoreProvider
All Implemented Interfaces:
EventListenerProvider, EventStoreProvider, Provider

public class JpaEventStoreProvider extends Object implements EventStoreProvider
Author:
Stian Thorgersen
  • Constructor Details

    • JpaEventStoreProvider

      public JpaEventStoreProvider(KeycloakSession session, jakarta.persistence.EntityManager em)
  • Method Details

    • createQuery

      public EventQuery createQuery()
      Description copied from interface: EventStoreProvider
      Returns an object representing auth event query of type EventQuery. The object is used for collecting requested properties of auth events (e.g. realm, operation, resourceType time boundaries, etc.) and contains the EventQuery.getResultStream() method that returns all objects from this store provider that have given properties.
      Specified by:
      createQuery in interface EventStoreProvider
      Returns:
      a query object
    • clear

      public void clear()
      Description copied from interface: EventStoreProvider
      Removes all auth events from this store provider.
      Specified by:
      clear in interface EventStoreProvider
    • clear

      public void clear(RealmModel realm)
      Description copied from interface: EventStoreProvider
      Removes all auth events for the realm from this store provider.
      Specified by:
      clear in interface EventStoreProvider
      Parameters:
      realm - the realm
    • clear

      public void clear(RealmModel realm, long olderThan)
      Description copied from interface: EventStoreProvider
      Removes all auth events for the realm that are older than olderThan from this store provider.
      Specified by:
      clear in interface EventStoreProvider
      Parameters:
      realm - the realm
      olderThan - point in time in milliseconds
    • clearExpiredEvents

      public void clearExpiredEvents()
      Description copied from interface: EventStoreProvider
      Clears all expired events in all realms
      Specified by:
      clearExpiredEvents in interface EventStoreProvider
    • onEvent

      public void onEvent(Event event)
      Description copied from interface: EventListenerProvider
      Called when a user event occurs e.g. log in, register.

      Note this method should not do any action that cannot be rolled back, see EventListenerProvider javadoc for more details.

      Specified by:
      onEvent in interface EventListenerProvider
      Parameters:
      event - to be triggered
    • createAdminQuery

      public AdminEventQuery createAdminQuery()
      Description copied from interface: EventStoreProvider
      Returns an object representing admin event query of type AdminEventQuery. The object is used for collecting requested properties of admin events (e.g. realm, operation, resourceType time boundaries, etc.) and contains the AdminEventQuery.getResultStream() method that returns all objects from this store provider that have given properties.
      Specified by:
      createAdminQuery in interface EventStoreProvider
      Returns:
      a query object
    • clearAdmin

      public void clearAdmin()
      Description copied from interface: EventStoreProvider
      Removes all admin events from this store provider.
      Specified by:
      clearAdmin in interface EventStoreProvider
    • clearAdmin

      public void clearAdmin(RealmModel realm)
      Description copied from interface: EventStoreProvider
      Removes all auth events for the realm from this store provider.
      Specified by:
      clearAdmin in interface EventStoreProvider
      Parameters:
      realm - the realm
    • clearAdmin

      public void clearAdmin(RealmModel realm, long olderThan)
      Description copied from interface: EventStoreProvider
      Removes all auth events for the realm that are older than olderThan from this store provider.
      Specified by:
      clearAdmin in interface EventStoreProvider
      Parameters:
      realm - the realm
      olderThan - point in time in milliseconds
    • onEvent

      public void onEvent(AdminEvent event, boolean includeRepresentation)
      Description copied from interface: EventListenerProvider
      Called when an admin event occurs e.g. a client was updated/deleted.

      Note this method should not do any action that cannot be rolled back, see EventListenerProvider javadoc for more details.

      Specified by:
      onEvent in interface EventListenerProvider
      Parameters:
      event - to be triggered
      includeRepresentation - when false, event listener should NOT include representation field in the resulting action
    • close

      public void close()
      Specified by:
      close in interface Provider
    • clearExpiredAdminEvents

      protected void clearExpiredAdminEvents()