Package org.keycloak.events.jpa
Class JpaEventStoreProvider
java.lang.Object
org.keycloak.events.jpa.JpaEventStoreProvider
- All Implemented Interfaces:
EventListenerProvider
,EventStoreProvider
,Provider
- Author:
- Stian Thorgersen
-
Constructor Summary
ConstructorDescriptionJpaEventStoreProvider
(KeycloakSession session, jakarta.persistence.EntityManager em, int maxDetailLength, int maxFieldLength) -
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Removes all auth events from this store provider.void
clear
(RealmModel realm) Removes all auth events for the realm from this store provider.void
clear
(RealmModel realm, long olderThan) Removes all auth events for the realm that are older thanolderThan
from this store provider.void
Removes all admin events from this store provider.void
clearAdmin
(RealmModel realm) Removes all auth events for the realm from this store provider.void
clearAdmin
(RealmModel realm, long olderThan) Removes all auth events for the realm that are older thanolderThan
from this store provider.protected void
void
Clears all expired events in all realmsvoid
close()
Returns an object representing admin event query of typeAdminEventQuery
.Returns an object representing auth event query of typeEventQuery
.void
onEvent
(AdminEvent event, boolean includeRepresentation) Called when an admin event occurs e.g.void
Called when a user event occurs e.g.
-
Constructor Details
-
JpaEventStoreProvider
public JpaEventStoreProvider(KeycloakSession session, jakarta.persistence.EntityManager em, int maxDetailLength, int maxFieldLength)
-
-
Method Details
-
createQuery
Description copied from interface:EventStoreProvider
Returns an object representing auth event query of typeEventQuery
. The object is used for collecting requested properties of auth events (e.g. realm, operation, resourceType time boundaries, etc.) and contains theEventQuery.getResultStream()
method that returns all objects from this store provider that have given properties.- Specified by:
createQuery
in interfaceEventStoreProvider
- 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 interfaceEventStoreProvider
-
clear
Description copied from interface:EventStoreProvider
Removes all auth events for the realm from this store provider.- Specified by:
clear
in interfaceEventStoreProvider
- Parameters:
realm
- the realm
-
clear
Description copied from interface:EventStoreProvider
Removes all auth events for the realm that are older thanolderThan
from this store provider.- Specified by:
clear
in interfaceEventStoreProvider
- Parameters:
realm
- the realmolderThan
- 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 interfaceEventStoreProvider
-
onEvent
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, seeEventListenerProvider
javadoc for more details.- Specified by:
onEvent
in interfaceEventListenerProvider
- Parameters:
event
- to be triggered
-
createAdminQuery
Description copied from interface:EventStoreProvider
Returns an object representing admin event query of typeAdminEventQuery
. The object is used for collecting requested properties of admin events (e.g. realm, operation, resourceType time boundaries, etc.) and contains theAdminEventQuery.getResultStream()
method that returns all objects from this store provider that have given properties.- Specified by:
createAdminQuery
in interfaceEventStoreProvider
- 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 interfaceEventStoreProvider
-
clearAdmin
Description copied from interface:EventStoreProvider
Removes all auth events for the realm from this store provider.- Specified by:
clearAdmin
in interfaceEventStoreProvider
- Parameters:
realm
- the realm
-
clearAdmin
Description copied from interface:EventStoreProvider
Removes all auth events for the realm that are older thanolderThan
from this store provider.- Specified by:
clearAdmin
in interfaceEventStoreProvider
- Parameters:
realm
- the realmolderThan
- point in time in milliseconds
-
onEvent
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, seeEventListenerProvider
javadoc for more details.- Specified by:
onEvent
in interfaceEventListenerProvider
- Parameters:
event
- to be triggeredincludeRepresentation
- when false, event listener should NOT include representation field in the resulting action
-
close
public void close() -
clearExpiredAdminEvents
protected void clearExpiredAdminEvents()
-