Deprecated old KeycloakSession APIs
This commit is contained in:
parent
1a227212de
commit
30b5c646e1
2 changed files with 33 additions and 11 deletions
|
@ -71,7 +71,7 @@ public interface KeycloakSession {
|
|||
* @param clazz
|
||||
* @param componentId Component configuration
|
||||
* @throws IllegalArgumentException If the realm is not set in the context.
|
||||
* @return Provider configured according to the {@link componentId}, {@code null} if it cannot be instantiated.
|
||||
* @return Provider configured according to the {@param componentId}, {@code null} if it cannot be instantiated.
|
||||
*/
|
||||
<T extends Provider> T getComponentProvider(Class<T> clazz, String componentId);
|
||||
|
||||
|
@ -83,7 +83,7 @@ public interface KeycloakSession {
|
|||
* @param componentId Component configuration
|
||||
* @param modelGetter Getter to retrieve componentModel
|
||||
* @throws IllegalArgumentException If the realm is not set in the context.
|
||||
* @return Provider configured according to the {@link componentId}, {@code null} if it cannot be instantiated.
|
||||
* @return Provider configured according to the {@param componentId}, {@code null} if it cannot be instantiated.
|
||||
*/
|
||||
<T extends Provider> T getComponentProvider(Class<T> clazz, String componentId, Function<KeycloakSessionFactory, ComponentModel> modelGetter);
|
||||
|
||||
|
@ -209,34 +209,39 @@ public interface KeycloakSession {
|
|||
*
|
||||
* @return may be null if cache is disabled
|
||||
*/
|
||||
@Deprecated
|
||||
UserCache userCache();
|
||||
|
||||
/**
|
||||
* A cached view of all users in system including users loaded by UserStorageProviders
|
||||
*
|
||||
* @return
|
||||
* @return UserProvider instance
|
||||
*/
|
||||
UserProvider users();
|
||||
|
||||
/**
|
||||
* @return ClientStorageManager instance
|
||||
*/
|
||||
@Deprecated
|
||||
ClientProvider clientStorageManager();
|
||||
|
||||
/**
|
||||
* @return ClientScopeStorageManager instance
|
||||
* @deprecated Use {@link #clientScopes()} instead
|
||||
*/
|
||||
@Deprecated
|
||||
ClientScopeProvider clientScopeStorageManager();
|
||||
|
||||
/**
|
||||
* @return RoleStorageManager instance
|
||||
*/
|
||||
@Deprecated
|
||||
RoleProvider roleStorageManager();
|
||||
|
||||
/**
|
||||
* @return GroupStorageManager instance
|
||||
*/
|
||||
@Deprecated
|
||||
GroupProvider groupStorageManager();
|
||||
|
||||
/**
|
||||
|
@ -244,11 +249,12 @@ public interface KeycloakSession {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
UserProvider userStorageManager();
|
||||
|
||||
/**
|
||||
* Service that allows you to valid and update credentials for a user
|
||||
* @deprecated Use {@link UserModel#getUserCredentialManager()} instead.
|
||||
* @deprecated Use {@link UserModel#credentialManager()} instead.
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
|
@ -256,11 +262,11 @@ public interface KeycloakSession {
|
|||
|
||||
/**
|
||||
* Keycloak specific local storage for users. No cache in front, this api talks directly to database configured for Keycloak
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
UserProvider userLocalStorage();
|
||||
|
||||
@Deprecated
|
||||
RealmProvider realmLocalStorage();
|
||||
|
||||
/**
|
||||
|
@ -268,6 +274,7 @@ public interface KeycloakSession {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
ClientProvider clientLocalStorage();
|
||||
|
||||
/**
|
||||
|
@ -276,6 +283,7 @@ public interface KeycloakSession {
|
|||
* @deprecated Use {@link #clientScopes()} instead
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
ClientScopeProvider clientScopeLocalStorage();
|
||||
|
||||
/**
|
||||
|
@ -283,6 +291,7 @@ public interface KeycloakSession {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
GroupProvider groupLocalStorage();
|
||||
|
||||
/**
|
||||
|
@ -290,6 +299,7 @@ public interface KeycloakSession {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
RoleProvider roleLocalStorage();
|
||||
|
||||
/**
|
||||
|
@ -298,6 +308,7 @@ public interface KeycloakSession {
|
|||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
UserFederatedStorageProvider userFederatedStorage();
|
||||
|
||||
/**
|
||||
|
|
|
@ -16,6 +16,8 @@
|
|||
*/
|
||||
package org.keycloak.services;
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
import org.keycloak.common.util.StackUtil;
|
||||
import org.keycloak.component.ComponentFactory;
|
||||
import org.keycloak.component.ComponentModel;
|
||||
import org.keycloak.jose.jws.DefaultTokenManager;
|
||||
|
@ -69,6 +71,7 @@ import java.util.stream.Collectors;
|
|||
*/
|
||||
public class DefaultKeycloakSession implements KeycloakSession {
|
||||
|
||||
private final static Logger log = Logger.getLogger(DefaultKeycloakSession.class);
|
||||
private final DefaultKeycloakSessionFactory factory;
|
||||
private final Map<Integer, Provider> providers = new HashMap<>();
|
||||
private final List<Provider> closable = new LinkedList<>();
|
||||
|
@ -167,59 +170,68 @@ public class DefaultKeycloakSession implements KeycloakSession {
|
|||
}
|
||||
|
||||
@Override
|
||||
@Deprecated // put deprecated on the interface
|
||||
@Deprecated
|
||||
public UserProvider userLocalStorage() {
|
||||
// TODO: if we would call users() here, we could get the cache in legacy mode instead and would then loop
|
||||
return getProvider(UserProvider.class);
|
||||
log.warnf("The semantics of this method have changed: Please see the migration guide on how to migrate.%s", StackUtil.getShortStackTrace());
|
||||
return users();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated // put deprecated on the interface (all *LocalStorage, all *Managers)
|
||||
@Deprecated
|
||||
public RealmProvider realmLocalStorage() {
|
||||
return realms();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ClientProvider clientLocalStorage() {
|
||||
return clients();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ClientScopeProvider clientScopeLocalStorage() {
|
||||
return clientScopes();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public GroupProvider groupLocalStorage() {
|
||||
return groups();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ClientProvider clientStorageManager() {
|
||||
return clients();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public ClientScopeProvider clientScopeStorageManager() {
|
||||
return clientScopes();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public RoleProvider roleLocalStorage() {
|
||||
return roles();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public RoleProvider roleStorageManager() {
|
||||
return roles();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public GroupProvider groupStorageManager() {
|
||||
return groups();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public UserProvider userStorageManager() {
|
||||
return users();
|
||||
}
|
||||
|
@ -322,7 +334,6 @@ public class DefaultKeycloakSession implements KeycloakSession {
|
|||
return null;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
ComponentFactory<T, T> componentFactory = (ComponentFactory<T, T>) providerFactory;
|
||||
T provider = componentFactory.create(this, componentModel);
|
||||
enlistForClose(provider);
|
||||
|
|
Loading…
Reference in a new issue