Examples of FirstResultReducer


Examples of org.keycloak.models.sessions.infinispan.mapreduce.FirstResultReducer

    @Override
    public List<UserSessionModel> getUserSessions(RealmModel realm, UserModel user) {
        Map<String, UserSessionEntity> sessions = new MapReduceTask(sessionCache)
                .mappedWith(UserSessionMapper.create(realm.getId()).user(user.getId()))
                .reducedWith(new FirstResultReducer())
                .execute();

        return wrapUserSessions(realm, sessions.values());
    }
View Full Code Here

Examples of org.keycloak.models.sessions.infinispan.mapreduce.FirstResultReducer

    @Override
    public void removeUserSessions(RealmModel realm, UserModel user) {
        Map<String, String> sessions = new MapReduceTask(sessionCache)
                .mappedWith(UserSessionMapper.create(realm.getId()).user(user.getId()).emitKey())
                .reducedWith(new FirstResultReducer())
                .execute();

        for (String id : sessions.keySet()) {
            removeUserSession(realm, id);
        }
View Full Code Here

Examples of org.keycloak.models.sessions.infinispan.mapreduce.FirstResultReducer

        int expired = Time.currentTime() - realm.getSsoSessionMaxLifespan();
        int expiredRefresh = Time.currentTime() - realm.getSsoSessionIdleTimeout();

        Map<String, String> map = new MapReduceTask(sessionCache)
                .mappedWith(UserSessionMapper.create(realm.getId()).expired(expired, expiredRefresh).emitKey())
                .reducedWith(new FirstResultReducer())
                .execute();

        for (String id : map.keySet()) {
            removeUserSession(realm, id);
        }

        map = new MapReduceTask(sessionCache)
                .mappedWith(ClientSessionMapper.create(realm.getId()).expiredRefresh(expiredRefresh).requireNullUserSession(true).emitKey())
                .reducedWith(new FirstResultReducer())
                .execute();

        for (String id : map.keySet()) {
            tx.remove(sessionCache, id);
        }
View Full Code Here

Examples of org.keycloak.models.sessions.infinispan.mapreduce.FirstResultReducer

    @Override
    public void removeUserSessions(RealmModel realm) {
        Map<String, String> ids = new MapReduceTask(sessionCache)
                .mappedWith(SessionMapper.create(realm.getId()).emitKey())
                .reducedWith(new FirstResultReducer())
                .execute();

        for (String id : ids.keySet()) {
            sessionCache.remove(id);
        }
View Full Code Here

Examples of org.keycloak.models.sessions.infinispan.mapreduce.FirstResultReducer

    @Override
    public void onClientRemoved(RealmModel realm, ClientModel client) {
        Map<String, String> map = new MapReduceTask(sessionCache)
                .mappedWith(ClientSessionMapper.create(realm.getId()).client(client.getId()).emitKey())
                .reducedWith(new FirstResultReducer())
                .execute();

        for (String id : map.keySet()) {
            tx.remove(sessionCache, id);
        }
View Full Code Here

Examples of org.keycloak.models.sessions.infinispan.mapreduce.FirstResultReducer

    void removeUserSession(RealmModel realm, String userSessionId) {
        tx.remove(sessionCache, userSessionId);

        Map<String, String> map = new MapReduceTask(sessionCache)
                .mappedWith(ClientSessionMapper.create(realm.getId()).userSession(userSessionId).emitKey())
                .reducedWith(new FirstResultReducer())
                .execute();

        for (String id : map.keySet()) {
            tx.remove(sessionCache, id);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.