Package org.keycloak.events.jpa
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 Summary
Constructors Constructor Description JpaEventStoreProvider(KeycloakSession session, javax.persistence.EntityManager em, int maxDetailLength, int maxFieldLength)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
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
clearAdmin()
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
clearExpiredAdminEvents()
void
clearExpiredEvents()
Clears all expired events in all realmsvoid
close()
AdminEventQuery
createAdminQuery()
Returns an object representing admin event query of typeAdminEventQuery
.EventQuery
createQuery()
Returns an object representing auth event query of typeEventQuery
.void
onEvent(AdminEvent event, boolean includeRepresentation)
Called when an admin event occurs e.g.void
onEvent(Event event)
Called when a user event occurs e.g.
-
-
-
Constructor Detail
-
JpaEventStoreProvider
public JpaEventStoreProvider(KeycloakSession session, javax.persistence.EntityManager em, int maxDetailLength, int maxFieldLength)
-
-
Method Detail
-
createQuery
public EventQuery 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
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 interfaceEventStoreProvider
- 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 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
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, seeEventListenerProvider
javadoc for more details.- Specified by:
onEvent
in interfaceEventListenerProvider
- Parameters:
event
- to be triggered
-
createAdminQuery
public AdminEventQuery 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
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 interfaceEventStoreProvider
- 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 thanolderThan
from this store provider.- Specified by:
clearAdmin
in interfaceEventStoreProvider
- Parameters:
realm
- the realmolderThan
- 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, 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
-
clearExpiredAdminEvents
protected void clearExpiredAdminEvents()
-
-