Package org.keycloak.events
Class EventBuilder
- java.lang.Object
-
- org.keycloak.events.EventBuilder
-
public class EventBuilder extends Object
- Author:
- Stian Thorgersen
-
-
Constructor Summary
Constructors Constructor Description EventBuilder(RealmModel realm, KeycloakSession session)
EventBuilder(RealmModel realm, KeycloakSession session, ClientConnection clientConnection)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description EventBuilder
client(String clientId)
EventBuilder
client(ClientModel client)
EventBuilder
clone()
EventBuilder
detail(String key, String value)
EventBuilder
detail(String key, Collection<String> values)
Add event detail where strings from the input Collection are filtered not to containnull
and then joined using::
character.EventBuilder
detail(String key, Stream<String> values)
Add event detail where strings from the input Stream are filtered not to containnull
and then joined using::
character.void
error(String error)
EventBuilder
event(EventType e)
Event
getEvent()
EventBuilder
ipAddress(String ipAddress)
EventBuilder
realm(String realmId)
EventBuilder
realm(RealmModel realm)
EventBuilder
removeDetail(String key)
EventBuilder
session(String sessionId)
EventBuilder
session(UserSessionModel session)
EventBuilder
storeImmediately(boolean forcedValue)
Sets the time when to store the event.void
success()
EventBuilder
user(String userId)
EventBuilder
user(UserModel user)
-
-
-
Constructor Detail
-
EventBuilder
public EventBuilder(RealmModel realm, KeycloakSession session, ClientConnection clientConnection)
-
EventBuilder
public EventBuilder(RealmModel realm, KeycloakSession session)
-
-
Method Detail
-
realm
public EventBuilder realm(RealmModel realm)
-
realm
public EventBuilder realm(String realmId)
-
client
public EventBuilder client(ClientModel client)
-
client
public EventBuilder client(String clientId)
-
user
public EventBuilder user(UserModel user)
-
user
public EventBuilder user(String userId)
-
session
public EventBuilder session(UserSessionModel session)
-
session
public EventBuilder session(String sessionId)
-
ipAddress
public EventBuilder ipAddress(String ipAddress)
-
event
public EventBuilder event(EventType e)
-
detail
public EventBuilder detail(String key, String value)
-
detail
public EventBuilder detail(String key, Collection<String> values)
Add event detail where strings from the input Collection are filtered not to containnull
and then joined using::
character.- Parameters:
key
- of the detailvalues
- , can be null- Returns:
- builder for chaining
-
detail
public EventBuilder detail(String key, Stream<String> values)
Add event detail where strings from the input Stream are filtered not to containnull
and then joined using::
character.- Parameters:
key
- of the detailvalues
- , can be null- Returns:
- builder for chaining
-
storeImmediately
public EventBuilder storeImmediately(boolean forcedValue)
Sets the time when to store the event. By default, events marked as success (success()
) are stored upon commit of the session's transaction while the failures (error(java.lang.String)
are stored and propagated to the event listeners immediately into the event store.- Parameters:
forcedValue
- Iftrue
, the event is stored in the event store immediately. Iffalse
, the event is stored upon commit.- Returns:
-
removeDetail
public EventBuilder removeDetail(String key)
-
getEvent
public Event getEvent()
-
success
public void success()
-
error
public void error(String error)
-
clone
public EventBuilder clone()
-
-