Merge pull request #1533 from stianst/master

KEYCLOAK-1702 Removed mem and none realm and user cache
This commit is contained in:
Stian Thorgersen 2015-08-13 08:24:13 +02:00
commit 248322c748
22 changed files with 35 additions and 873 deletions

View file

@ -26,14 +26,6 @@
"provider" : "infinispan"
},
"realmCache": {
"provider": "infinispan"
},
"userCache": {
"provider": "infinispan"
},
"timer": {
"provider": "basic"
},
@ -48,18 +40,6 @@
}
},
"login": {
"provider": "freemarker"
},
"account": {
"provider": "freemarker"
},
"email": {
"provider": "freemarker"
},
"scheduled": {
"interval": 900
},

View file

@ -82,13 +82,16 @@
<section>
<title>Migrating to 1.5.0.Final</title>
<simplesect>
<title>Infinispan set to default cache and user session providers</title>
<title>Realm and User cache providers</title>
<para>
Infinispan is now the default cache and user session provider.
Infinispan is now the default realm and user cache provider. In non-clustered mode a local Infinispan cache is used. We've also removed our
custom in-memory cache and the no cache providers. If you have realmCache or userCache set in keycloak-server.json to mem or none please
remove these. As Infinispan is the only provider there's no longer any need for the realmCache and userCache objects so these can
be removed.
</para>
</simplesect>
<simplesect>
<title>Mem user session provider</title>
<title>User Session provider</title>
<para>
The mem user session provider has been removed. Instead the Infinispan user session provider with a local cache should be used.
</para>

View file

@ -1,17 +1,11 @@
package org.keycloak.models.cache;
package org.keycloak.models.cache.infinispan;
import org.keycloak.models.ClientModel;
import org.keycloak.models.ProtocolMapperModel;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleContainerModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.*;
import org.keycloak.models.cache.CacheRealmProvider;
import org.keycloak.models.cache.RealmCache;
import org.keycloak.models.cache.entities.CachedClient;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>

View file

@ -1,24 +1,11 @@
package org.keycloak.models.cache;
package org.keycloak.models.cache.infinispan;
import org.keycloak.migration.MigrationModel;
import org.keycloak.models.ClientModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakTransaction;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RealmProvider;
import org.keycloak.models.RoleModel;
import org.keycloak.models.cache.entities.CachedClient;
import org.keycloak.models.cache.entities.CachedClientRole;
import org.keycloak.models.cache.entities.CachedRealm;
import org.keycloak.models.cache.entities.CachedRealmRole;
import org.keycloak.models.cache.entities.CachedRole;
import org.keycloak.models.*;
import org.keycloak.models.cache.*;
import org.keycloak.models.cache.entities.*;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>

View file

@ -1,24 +1,11 @@
package org.keycloak.models.cache;
package org.keycloak.models.cache.infinispan;
import org.keycloak.models.ClientModel;
import org.keycloak.models.CredentialValidationOutput;
import org.keycloak.models.FederatedIdentityModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakTransaction;
import org.keycloak.models.ProtocolMapperModel;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserFederationProviderModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.UserProvider;
import org.keycloak.models.*;
import org.keycloak.models.cache.CacheUserProvider;
import org.keycloak.models.cache.UserCache;
import org.keycloak.models.cache.entities.CachedUser;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>

View file

@ -7,7 +7,6 @@ import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.models.cache.CacheRealmProvider;
import org.keycloak.models.cache.CacheRealmProviderFactory;
import org.keycloak.models.cache.DefaultCacheRealmProvider;
import org.keycloak.models.cache.RealmCache;
import java.util.concurrent.ConcurrentHashMap;

View file

@ -12,7 +12,6 @@ import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
import org.keycloak.models.cache.CacheUserProvider;
import org.keycloak.models.cache.CacheUserProviderFactory;
import org.keycloak.models.cache.DefaultCacheUserProvider;
import org.keycloak.models.cache.entities.CachedUser;
import java.util.concurrent.ConcurrentHashMap;

View file

@ -1,21 +1,10 @@
package org.keycloak.models.cache;
package org.keycloak.models.cache.infinispan;
import org.keycloak.Config;
import org.keycloak.enums.SslRequired;
import org.keycloak.models.AuthenticationExecutionModel;
import org.keycloak.models.AuthenticationFlowModel;
import org.keycloak.models.AuthenticatorConfigModel;
import org.keycloak.models.ClientModel;
import org.keycloak.models.IdentityProviderMapperModel;
import org.keycloak.models.IdentityProviderModel;
import org.keycloak.models.OTPPolicy;
import org.keycloak.models.PasswordPolicy;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RequiredActionProviderModel;
import org.keycloak.models.RequiredCredentialModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.UserFederationMapperModel;
import org.keycloak.models.UserFederationProviderModel;
import org.keycloak.models.*;
import org.keycloak.models.cache.CacheRealmProvider;
import org.keycloak.models.cache.RealmCache;
import org.keycloak.models.cache.entities.CachedRealm;
import org.keycloak.models.utils.KeycloakModelUtils;
@ -23,13 +12,7 @@ import java.security.Key;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>

View file

@ -1,8 +1,10 @@
package org.keycloak.models.cache;
package org.keycloak.models.cache.infinispan;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleContainerModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.cache.CacheRealmProvider;
import org.keycloak.models.cache.RealmCache;
import org.keycloak.models.cache.entities.CachedClientRole;
import org.keycloak.models.cache.entities.CachedRealmRole;
import org.keycloak.models.cache.entities.CachedRole;

View file

@ -1,22 +1,11 @@
package org.keycloak.models.cache;
package org.keycloak.models.cache.infinispan;
import org.keycloak.models.ClientModel;
import org.keycloak.models.UserConsentModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleContainerModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserCredentialValueModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.*;
import org.keycloak.models.cache.CacheUserProvider;
import org.keycloak.models.cache.entities.CachedUser;
import org.keycloak.models.utils.KeycloakModelUtils;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>

View file

@ -1,39 +0,0 @@
package org.keycloak.models.cache;
import org.keycloak.Config;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class MemoryCacheRealmProviderFactory implements CacheRealmProviderFactory {
protected RealmCache cache = new MemoryRealmCache();
@Override
public CacheRealmProvider create(KeycloakSession session) {
return new DefaultCacheRealmProvider(cache, session);
}
@Override
public void init(Config.Scope config) {
config.get("");
}
@Override
public void postInit(KeycloakSessionFactory factory) {
}
@Override
public void close() {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public String getId() {
return "mem";
}
}

View file

@ -1,41 +0,0 @@
package org.keycloak.models.cache;
import org.keycloak.Config;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class MemoryCacheUserProviderFactory implements CacheUserProviderFactory {
protected MemoryUserCache cache;
@Override
public CacheUserProvider create(KeycloakSession session) {
return new DefaultCacheUserProvider(cache, session);
}
@Override
public void init(Config.Scope config) {
config.get("");
cache = new MemoryUserCache();
int size = config.getInt("maxSize", 10000);
cache.setMaxUserCacheSize(size);
}
@Override
public void postInit(KeycloakSessionFactory factory) {
}
@Override
public void close() {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public String getId() {
return "mem";
}
}

View file

@ -1,122 +0,0 @@
package org.keycloak.models.cache;
import org.keycloak.models.cache.entities.CachedClient;
import org.keycloak.models.cache.entities.CachedRealm;
import org.keycloak.models.cache.entities.CachedRole;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class MemoryRealmCache implements RealmCache {
protected ConcurrentHashMap<String, CachedRealm> realmCache = new ConcurrentHashMap<String, CachedRealm>();
protected ConcurrentHashMap<String, CachedRealm> realmCacheByName = new ConcurrentHashMap<String, CachedRealm>();
protected ConcurrentHashMap<String, CachedClient> applicationCache = new ConcurrentHashMap<String, CachedClient>();
protected ConcurrentHashMap<String, CachedRole> roleCache = new ConcurrentHashMap<String, CachedRole>();
protected volatile boolean enabled = true;
@Override
public void clear() {
realmCache.clear();
realmCacheByName.clear();
applicationCache.clear();
roleCache.clear();
}
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public void setEnabled(boolean enabled) {
clear();
this.enabled = enabled;
clear();
}
@Override
public CachedRealm getCachedRealm(String id) {
if (!enabled) return null;
return realmCache.get(id);
}
@Override
public void invalidateCachedRealm(CachedRealm realm) {
realmCache.remove(realm.getId());
realmCacheByName.remove(realm.getName());
}
@Override
public void invalidateCachedRealmById(String id) {
CachedRealm cached = realmCache.remove(id);
if (cached != null) realmCacheByName.remove(cached.getName());
}
@Override
public void addCachedRealm(CachedRealm realm) {
if (!enabled) return;
realmCache.put(realm.getId(), realm);
realmCacheByName.put(realm.getName(), realm);
}
@Override
public CachedRealm getCachedRealmByName(String name) {
if (!enabled) return null;
return realmCacheByName.get(name);
}
@Override
public CachedClient getApplication(String id) {
if (!enabled) return null;
return applicationCache.get(id);
}
@Override
public void invalidateApplication(CachedClient app) {
applicationCache.remove(app.getId());
}
@Override
public void addCachedClient(CachedClient app) {
if (!enabled) return;
applicationCache.put(app.getId(), app);
}
@Override
public void invalidateCachedApplicationById(String id) {
applicationCache.remove(id);
}
@Override
public CachedRole getRole(String id) {
if (!enabled) return null;
return roleCache.get(id);
}
@Override
public void invalidateRole(CachedRole role) {
roleCache.remove(role);
}
@Override
public void invalidateRoleById(String id) {
roleCache.remove(id);
}
@Override
public void addCachedRole(CachedRole role) {
if (!enabled) return;
roleCache.put(role.getId(), role);
}
@Override
public void invalidateCachedRoleById(String id) {
roleCache.remove(id);
}
}

View file

@ -1,158 +0,0 @@
package org.keycloak.models.cache;
import org.keycloak.models.cache.entities.CachedUser;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class MemoryUserCache implements UserCache {
protected int maxUserCacheSize = 10000;
protected volatile boolean enabled = true;
protected class RealmUsers {
protected class LRUCache extends LinkedHashMap<String, CachedUser> {
public LRUCache() {
super(1000, 1.1F, true);
}
@Override
public CachedUser put(String key, CachedUser value) {
if (value.getUsername() != null) {
usersByUsername.put(value.getUsername(), value);
}
if (value.getEmail() != null) {
usersByEmail.put(value.getEmail(), value);
}
return super.put(key, value);
}
@Override
public CachedUser remove(Object key) {
CachedUser user = super.remove(key);
if (user == null) return null;
removeUser(user);
return user;
}
@Override
public void clear() {
super.clear();
usersByUsername.clear();
usersByEmail.clear();
}
@Override
protected boolean removeEldestEntry(Map.Entry<String, CachedUser> eldest) {
boolean evict = size() > maxUserCacheSize;
if (evict) {
removeUser(eldest.getValue());
}
return evict;
}
private void removeUser(CachedUser value) {
if (value.getUsername() != null) usersByUsername.remove(value.getUsername());
if (value.getEmail() != null) usersByEmail.remove(value.getEmail());
}
}
protected Map<String, CachedUser> usersById = Collections.synchronizedMap(new LRUCache());
protected Map<String, CachedUser> usersByUsername = new ConcurrentHashMap<String, CachedUser>();
protected Map<String, CachedUser> usersByEmail = new ConcurrentHashMap<String, CachedUser>();
}
protected ConcurrentHashMap<String, RealmUsers> realmUsers = new ConcurrentHashMap<String, RealmUsers>();
public int getMaxUserCacheSize() {
return maxUserCacheSize;
}
public void setMaxUserCacheSize(int maxUserCacheSize) {
this.maxUserCacheSize = maxUserCacheSize;
}
@Override
public boolean isEnabled() {
return enabled;
}
@Override
public void setEnabled(boolean enabled) {
clear();
this.enabled = enabled;
clear();
}
@Override
public CachedUser getCachedUser(String realmId, String id) {
if (realmId == null || id == null) return null;
RealmUsers users = realmUsers.get(realmId);
if (users == null) return null;
return users.usersById.get(id);
}
@Override
public void invalidateCachedUser(String realmId, CachedUser user) {
RealmUsers users = realmUsers.get(realmId);
if (users == null) return;
users.usersById.remove(user.getId());
}
@Override
public void invalidateCachedUserById(String realmId, String id) {
RealmUsers users = realmUsers.get(realmId);
if (users == null) return;
users.usersById.remove(id);
}
@Override
public void addCachedUser(String realmId, CachedUser user) {
RealmUsers users = realmUsers.get(realmId);
if (users == null) {
users = new RealmUsers();
realmUsers.put(realmId, users);
}
users.usersById.put(user.getId(), user);
}
@Override
public CachedUser getCachedUserByUsername(String realmId, String name) {
if (realmId == null || name == null) return null;
RealmUsers users = realmUsers.get(realmId);
if (users == null) return null;
CachedUser user = users.usersByUsername.get(name);
if (user == null) return null;
users.usersById.get(user.getId()); // refresh cache entry age
return user;
}
@Override
public CachedUser getCachedUserByEmail(String realmId, String email) {
if (realmId == null || email == null) return null;
RealmUsers users = realmUsers.get(realmId);
if (users == null) return null;
CachedUser user = users.usersByEmail.get(email);
if (user == null) return null;
users.usersById.get(user.getId()); // refresh cache entry age
return user;
}
@Override
public void invalidateRealmUsers(String realmId) {
realmUsers.remove(realmId);
}
@Override
public void clear() {
realmUsers.clear();
}
}

View file

@ -1,103 +0,0 @@
package org.keycloak.models.cache;
import org.keycloak.migration.MigrationModel;
import org.keycloak.models.ClientModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RealmProvider;
import org.keycloak.models.RoleModel;
import java.util.List;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class NoCacheRealmProvider implements CacheRealmProvider {
protected KeycloakSession session;
protected RealmProvider delegate;
public NoCacheRealmProvider(KeycloakSession session) {
this.session = session;
}
@Override
public boolean isEnabled() {
return false; //To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void setEnabled(boolean enabled) {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public RealmProvider getDelegate() {
if (delegate != null) return delegate;
delegate = session.getProvider(RealmProvider.class);
return delegate;
}
@Override
public void registerRealmInvalidation(String id) {
}
@Override
public void registerApplicationInvalidation(String id) {
}
@Override
public void registerRoleInvalidation(String id) {
}
@Override
public MigrationModel getMigrationModel() {
return getDelegate().getMigrationModel();
}
@Override
public RealmModel createRealm(String name) {
return getDelegate().createRealm(name);
}
@Override
public RealmModel createRealm(String id, String name) {
return getDelegate().createRealm(id, name);
}
@Override
public RealmModel getRealm(String id) {
return getDelegate().getRealm(id);
}
@Override
public RealmModel getRealmByName(String name) {
return getDelegate().getRealmByName(name);
}
@Override
public List<RealmModel> getRealms() {
// we don't cache this for now
return getDelegate().getRealms();
}
@Override
public boolean removeRealm(String id) {
return getDelegate().removeRealm(id);
}
@Override
public void close() {
if (delegate != null) delegate.close();
}
@Override
public RoleModel getRoleById(String id, RealmModel realm) {
return getDelegate().getRoleById(id, realm);
}
@Override
public ClientModel getClientById(String id, RealmModel realm) {
return getDelegate().getClientById(id, realm);
}
}

View file

@ -1,36 +0,0 @@
package org.keycloak.models.cache;
import org.keycloak.Config;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class NoCacheRealmProviderFactory implements CacheRealmProviderFactory {
@Override
public CacheRealmProvider create(KeycloakSession session) {
return new NoCacheRealmProvider(session);
}
@Override
public void close() {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void init(Config.Scope config) {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void postInit(KeycloakSessionFactory factory) {
}
@Override
public String getId() {
return "none";
}
}

View file

@ -1,200 +0,0 @@
package org.keycloak.models.cache;
import org.keycloak.models.ClientModel;
import org.keycloak.models.CredentialValidationOutput;
import org.keycloak.models.FederatedIdentityModel;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.ProtocolMapperModel;
import org.keycloak.models.RealmModel;
import org.keycloak.models.RoleModel;
import org.keycloak.models.UserCredentialModel;
import org.keycloak.models.UserFederationProviderModel;
import org.keycloak.models.UserModel;
import org.keycloak.models.UserProvider;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class NoCacheUserProvider implements CacheUserProvider {
protected KeycloakSession session;
protected UserProvider delegate;
public NoCacheUserProvider(KeycloakSession session) {
this.session = session;
}
@Override
public boolean isEnabled() {
return false;
}
@Override
public void setEnabled(boolean enabled) {
}
@Override
public UserProvider getDelegate() {
if (delegate != null) return delegate;
delegate = session.getProvider(UserProvider.class);
return delegate;
}
@Override
public void registerUserInvalidation(RealmModel realm, String id) {
}
@Override
public UserModel getUserById(String id, RealmModel realm) {
return getDelegate().getUserById(id, realm);
}
@Override
public UserModel getUserByUsername(String username, RealmModel realm) {
return getDelegate().getUserByUsername(username, realm);
}
@Override
public UserModel getUserByEmail(String email, RealmModel realm) {
return getDelegate().getUserByEmail(email, realm);
}
@Override
public void close() {
if (delegate != null) delegate.close();
}
@Override
public UserModel getUserByFederatedIdentity(FederatedIdentityModel socialLink, RealmModel realm) {
return getDelegate().getUserByFederatedIdentity(socialLink, realm);
}
@Override
public UserModel getUserByServiceAccountClient(ClientModel client) {
return getDelegate().getUserByServiceAccountClient(client);
}
@Override
public List<UserModel> getUsers(RealmModel realm, boolean includeServiceAccounts) {
return getDelegate().getUsers(realm, includeServiceAccounts);
}
@Override
public int getUsersCount(RealmModel realm) {
return getDelegate().getUsersCount(realm);
}
@Override
public List<UserModel> getUsers(RealmModel realm, int firstResult, int maxResults, boolean includeServiceAccounts) {
return getDelegate().getUsers(realm, firstResult, maxResults, includeServiceAccounts);
}
@Override
public List<UserModel> searchForUser(String search, RealmModel realm) {
return getDelegate().searchForUser(search, realm);
}
@Override
public List<UserModel> searchForUser(String search, RealmModel realm, int firstResult, int maxResults) {
return getDelegate().searchForUser(search, realm, firstResult, maxResults);
}
@Override
public List<UserModel> searchForUserByAttributes(Map<String, String> attributes, RealmModel realm) {
return getDelegate().searchForUserByAttributes(attributes, realm);
}
@Override
public List<UserModel> searchForUserByAttributes(Map<String, String> attributes, RealmModel realm, int firstResult, int maxResults) {
return getDelegate().searchForUserByAttributes(attributes, realm, firstResult, maxResults);
}
@Override
public List<UserModel> searchForUserByUserAttributes(Map<String, String> attributes, RealmModel realm) {
return getDelegate().searchForUserByUserAttributes(attributes, realm);
}
@Override
public Set<FederatedIdentityModel> getFederatedIdentities(UserModel user, RealmModel realm) {
return getDelegate().getFederatedIdentities(user, realm);
}
@Override
public FederatedIdentityModel getFederatedIdentity(UserModel user, String socialProvider, RealmModel realm) {
return getDelegate().getFederatedIdentity(user, socialProvider, realm);
}
@Override
public UserModel addUser(RealmModel realm, String id, String username, boolean addDefaultRoles, boolean addDefaultRequiredActions) {
return getDelegate().addUser(realm, id, username, addDefaultRoles, addDefaultRequiredActions);
}
@Override
public UserModel addUser(RealmModel realm, String username) {
return getDelegate().addUser(realm, username);
}
@Override
public boolean removeUser(RealmModel realm, UserModel user) {
return getDelegate().removeUser(realm, user);
}
@Override
public void addFederatedIdentity(RealmModel realm, UserModel user, FederatedIdentityModel socialLink) {
getDelegate().addFederatedIdentity(realm, user, socialLink);
}
@Override
public void updateFederatedIdentity(RealmModel realm, UserModel federatedUser, FederatedIdentityModel federatedIdentityModel) {
getDelegate().updateFederatedIdentity(realm, federatedUser, federatedIdentityModel);
}
@Override
public boolean removeFederatedIdentity(RealmModel realm, UserModel user, String socialProvider) {
return getDelegate().removeFederatedIdentity(realm, user, socialProvider);
}
@Override
public boolean validCredentials(RealmModel realm, UserModel user, List<UserCredentialModel> input) {
return getDelegate().validCredentials(realm, user, input);
}
@Override
public boolean validCredentials(RealmModel realm, UserModel user, UserCredentialModel... input) {
return getDelegate().validCredentials(realm, user, input);
}
@Override
public CredentialValidationOutput validCredentials(RealmModel realm, UserCredentialModel... input) {
return getDelegate().validCredentials(realm, input);
}
@Override
public void preRemove(RealmModel realm) {
getDelegate().preRemove(realm);
}
@Override
public void preRemove(RealmModel realm, UserFederationProviderModel link) {
getDelegate().preRemove(realm, link);
}
@Override
public void preRemove(RealmModel realm, RoleModel role) {
getDelegate().preRemove(realm, role);
}
@Override
public void preRemove(RealmModel realm, ClientModel client) {
getDelegate().preRemove(realm, client);
}
@Override
public void preRemove(ClientModel client, ProtocolMapperModel protocolMapper) {
getDelegate().preRemove(client, protocolMapper);
}
}

View file

@ -1,36 +0,0 @@
package org.keycloak.models.cache;
import org.keycloak.Config;
import org.keycloak.models.KeycloakSession;
import org.keycloak.models.KeycloakSessionFactory;
/**
* @author <a href="mailto:bill@burkecentral.com">Bill Burke</a>
* @version $Revision: 1 $
*/
public class NoCacheUserProviderFactory implements CacheUserProviderFactory {
@Override
public CacheUserProvider create(KeycloakSession session) {
return new NoCacheUserProvider(session);
}
@Override
public void close() {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void init(Config.Scope config) {
//To change body of implemented methods use File | Settings | File Templates.
}
@Override
public void postInit(KeycloakSessionFactory factory) {
}
@Override
public String getId() {
return "none";
}
}

View file

@ -1,2 +0,0 @@
org.keycloak.models.cache.MemoryCacheRealmProviderFactory
org.keycloak.models.cache.NoCacheRealmProviderFactory

View file

@ -1,2 +0,0 @@
org.keycloak.models.cache.MemoryCacheUserProviderFactory
org.keycloak.models.cache.NoCacheUserProviderFactory

View file

@ -6,6 +6,7 @@ import org.junit.Assert;
import org.junit.ClassRule;
import org.junit.Test;
import org.keycloak.models.*;
import org.keycloak.models.cache.infinispan.RealmAdapter;
import org.keycloak.testsuite.rule.KeycloakRule;
import static org.junit.Assert.assertNotNull;
@ -45,7 +46,7 @@ public class CacheTest {
}
}
Assert.assertTrue(realm instanceof org.keycloak.models.cache.RealmAdapter);
Assert.assertTrue(realm instanceof RealmAdapter);
realm.setAccessCodeLifespanLogin(200);
ClientModel testApp = realm.getClientByClientId("test-app");
assertNotNull(testApp);

View file

@ -26,17 +26,6 @@
"provider" : "${keycloak.userSessions.provider:infinispan}"
},
"realmCache": {
"provider": "${keycloak.realm.cache.provider:infinispan}"
},
"userCache": {
"provider": "${keycloak.user.cache.provider:infinispan}",
"mem": {
"maxSize": 20000
}
},
"timer": {
"provider": "basic"
},
@ -51,18 +40,6 @@
}
},
"login": {
"provider": "freemarker"
},
"account": {
"provider": "freemarker"
},
"email": {
"provider": "freemarker"
},
"scheduled": {
"interval": 900
},