protected List<UserSessionModel> getUserSessions(final RealmModel realm, ClientModel client, int firstResult, int maxResults, final boolean offline) { final String clientUuid = client.getId(); UserSessionPredicate predicate = UserSessionPredicate.create(realm.getId()).client(clientUuid); return getUserSessionModels(realm, firstResult, maxResults, offline, predicate); }
protected long getUserSessionsCount(RealmModel realm, ClientModel client, boolean offline) { Cache<String, SessionEntityWrapper<UserSessionEntity>> cache = getCache(offline); cache = CacheDecorators.skipCacheLoaders(cache); final String clientUuid = client.getId(); return cache.entrySet().stream() .filter(UserSessionPredicate.create(realm.getId()).client(clientUuid)) .count(); }
public UserSessionPredicate readObjectVersion1(ObjectInput input) throws IOException, ClassNotFoundException { UserSessionPredicate res = new UserSessionPredicate(MarshallUtil.unmarshallString(input)); res.user(MarshallUtil.unmarshallString(input)); res.client(MarshallUtil.unmarshallString(input)); res.expired(KeycloakMarshallUtil.unmarshallInteger(input), KeycloakMarshallUtil.unmarshallInteger(input)); res.brokerSessionId(MarshallUtil.unmarshallString(input)); res.brokerUserId(MarshallUtil.unmarshallString(input)); return res; }
public UserSessionPredicate readObjectVersion2(ObjectInput input) throws IOException, ClassNotFoundException { UserSessionPredicate res = new UserSessionPredicate(MarshallUtil.unmarshallString(input)); res.user(MarshallUtil.unmarshallString(input)); res.client(MarshallUtil.unmarshallString(input)); res.expired(KeycloakMarshallUtil.unmarshallInteger(input), KeycloakMarshallUtil.unmarshallInteger(input), KeycloakMarshallUtil.unmarshallInteger(input), KeycloakMarshallUtil.unmarshallInteger(input)); res.brokerSessionId(MarshallUtil.unmarshallString(input)); res.brokerUserId(MarshallUtil.unmarshallString(input)); return res; } }