Package org.keycloak.events

Examples of org.keycloak.events.EventStoreProvider


*/
public class ClearExpiredEvents implements ScheduledTask {

    @Override
    public void run(KeycloakSession session) {
        EventStoreProvider eventStore = session.getProvider(EventStoreProvider.class);
        if (eventStore != null) {
            for (RealmModel realm : session.realms().getRealms()) {
                if (realm.isEventsEnabled() && realm.getEventsExpiration() > 0) {
                    long olderThan = System.currentTimeMillis() - realm.getEventsExpiration() * 1000;
                    eventStore.clear(realm.getId(), olderThan);
                }
            }
        }
    }
View Full Code Here


    @Produces(MediaType.APPLICATION_JSON)
    public List<Event> getEvents(@QueryParam("client") String client, @QueryParam("type") String type, @QueryParam("user") String user,
                                 @QueryParam("ipAddress") String ipAddress, @QueryParam("first") Integer firstResult, @QueryParam("max") Integer maxResults) {
        auth.init(RealmAuth.Resource.EVENTS).requireView();

        EventStoreProvider eventStore = session.getProvider(EventStoreProvider.class);

        EventQuery query = eventStore.createQuery().realm(realm.getId());
        if (client != null) {
            query.client(client);
        }
        if (type != null) {
            query.type(EventType.valueOf(type));
View Full Code Here

    @Path("events")
    @DELETE
    public void clearEvents() {
        auth.init(RealmAuth.Resource.EVENTS).requireManage();

        EventStoreProvider eventStore = session.getProvider(EventStoreProvider.class);
        eventStore.clear(realm.getId());
    }
View Full Code Here

    public EventBuilder createEventBuilder() {
        List<EventListenerProvider> listeners = new LinkedList<EventListenerProvider>();

        if (realm.isEventsEnabled()) {
            EventStoreProvider eventStore = session.getProvider(EventStoreProvider.class);
            if (eventStore != null) {
                listeners.add(eventStore);
            } else {
                log.error("Events enabled, but no event store provider configured");
            }
View Full Code Here

TOP

Related Classes of org.keycloak.events.EventStoreProvider

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.