This commit is contained in:
Bill Burke 2014-07-23 10:42:18 -04:00
parent 148d494905
commit f1d72d0b6d
2 changed files with 13 additions and 5 deletions

View file

@ -13,6 +13,10 @@ import java.util.Set;
public class FederationManager implements UserProvider {
protected KeycloakSession session;
public FederationManager(KeycloakSession session) {
this.session = session;
}
@Override
public UserModel addUser(RealmModel realm, String id, String username, boolean addDefaultRoles) {
UserModel user = session.userStorage().addUser(realm, id, username, addDefaultRoles);

View file

@ -1,5 +1,6 @@
package org.keycloak.services;
import org.keycloak.models.FederationManager;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.models.KeycloakTransactionManager;
@ -27,10 +28,12 @@ public class DefaultKeycloakSession implements KeycloakSession {
private RealmProvider model;
private UserProvider userModel;
private UserSessionProvider sessionProvider;
private FederationManager federationManager;
public DefaultKeycloakSession(DefaultKeycloakSessionFactory factory) {
this.factory = factory;
this.transactionManager = new DefaultKeycloakTransactionManager();
federationManager = new FederationManager(this);
}
private RealmProvider getRealmProvider() {
@ -61,7 +64,11 @@ public class DefaultKeycloakSession implements KeycloakSession {
@Override
public UserProvider userStorage() {
return null;
if (userModel == null) {
userModel = getUserProvider();
}
return userModel;
}
public <T extends Provider> T getProvider(Class<T> clazz) {
@ -113,10 +120,7 @@ public class DefaultKeycloakSession implements KeycloakSession {
@Override
public UserProvider users() {
if (userModel == null) {
userModel = getUserProvider();
}
return userModel;
return federationManager;
}
@Override