userprovider split
This commit is contained in:
1 parent
8f7efd5b67
commit
ff86bdc35f
110 files changed
+1467
-1428
No files matched your search
Regular → Executable
+5
-5
@@ -47,7 +47,7 @@ public class MongoUserSessionProvider implements UserSessionProvider {
|
||||
entity.setLastSessionRefresh(currentTime);
|
||||
|
||||
mongoStore.insertEntity(entity, invocationContext);
|
||||
return new UserSessionAdapter(entity, realm, invocationContext);
|
||||
return new UserSessionAdapter(session, entity, realm, invocationContext);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +56,7 @@ public class MongoUserSessionProvider implements UserSessionProvider {
|
||||
if (entity == null) {
|
||||
return null;
|
||||
} else {
|
||||
return new UserSessionAdapter(entity, realm, invocationContext);
|
||||
return new UserSessionAdapter(session, entity, realm, invocationContext);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MongoUserSessionProvider implements UserSessionProvider {
|
||||
DBObject query = new BasicDBObject("user", user.getId());
|
||||
List<UserSessionModel> sessions = new LinkedList<UserSessionModel>();
|
||||
for (MongoUserSessionEntity e : mongoStore.loadEntities(MongoUserSessionEntity.class, query, invocationContext)) {
|
||||
sessions.add(new UserSessionAdapter(e, realm, invocationContext));
|
||||
sessions.add(new UserSessionAdapter(session, e, realm, invocationContext));
|
||||
}
|
||||
return sessions;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ public class MongoUserSessionProvider implements UserSessionProvider {
|
||||
|
||||
List<UserSessionModel> result = new LinkedList<UserSessionModel>();
|
||||
for (MongoUserSessionEntity session : sessions) {
|
||||
result.add(new UserSessionAdapter(session, realm, invocationContext));
|
||||
result.add(new UserSessionAdapter(this.session, session, realm, invocationContext));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class MongoUserSessionProvider implements UserSessionProvider {
|
||||
List<MongoUserSessionEntity> sessions = mongoStore.loadEntities(MongoUserSessionEntity.class, query, sort, invocationContext, firstResult, maxResults);
|
||||
List<UserSessionModel> result = new LinkedList<UserSessionModel>();
|
||||
for (MongoUserSessionEntity session : sessions) {
|
||||
result.add(new UserSessionAdapter(session, realm, invocationContext));
|
||||
result.add(new UserSessionAdapter(this.session, session, realm, invocationContext));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
+5
-2
@@ -3,6 +3,7 @@ package org.keycloak.models.sessions.mongo;
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.connections.mongo.api.context.MongoStoreInvocationContext;
|
||||
import org.keycloak.models.ClientModel;
|
||||
import org.keycloak.models.KeycloakSession;
|
||||
import org.keycloak.models.RealmModel;
|
||||
import org.keycloak.models.UserModel;
|
||||
import org.keycloak.models.UserSessionModel;
|
||||
@@ -20,12 +21,14 @@ public class UserSessionAdapter extends AbstractMongoAdapter<MongoUserSessionEnt
|
||||
|
||||
private MongoUserSessionEntity entity;
|
||||
private RealmModel realm;
|
||||
private KeycloakSession keycloakSession;
|
||||
|
||||
public UserSessionAdapter(MongoUserSessionEntity entity, RealmModel realm, MongoStoreInvocationContext invContext)
|
||||
public UserSessionAdapter(KeycloakSession keycloakSession, MongoUserSessionEntity entity, RealmModel realm, MongoStoreInvocationContext invContext)
|
||||
{
|
||||
super(invContext);
|
||||
this.entity = entity;
|
||||
this.realm = realm;
|
||||
this.keycloakSession = keycloakSession;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -46,7 +49,7 @@ public class UserSessionAdapter extends AbstractMongoAdapter<MongoUserSessionEnt
|
||||
|
||||
@Override
|
||||
public UserModel getUser() {
|
||||
return realm.getUserById(entity.getUser());
|
||||
return keycloakSession.users().getUserById(entity.getUser(), realm);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user