Instead of returning instances with different semantics, throw an exception.
This exception points the caller to the migration guide of Keycloak 19. Closes #12556
This commit is contained in:
parent
c02059e0e5
commit
d407a37ba3
2 changed files with 18 additions and 28 deletions
|
@ -206,6 +206,8 @@ public interface KeycloakSession {
|
||||||
/**
|
/**
|
||||||
* The user cache
|
* The user cache
|
||||||
*
|
*
|
||||||
|
* @deprecated The access to the UserCache interface is no longer possible here, and this method is about to be removed.
|
||||||
|
* Adjust your code according to the Keycloak 19 Upgrading Guide.
|
||||||
* @return may be null if cache is disabled
|
* @return may be null if cache is disabled
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
@ -271,7 +273,7 @@ public interface KeycloakSession {
|
||||||
/**
|
/**
|
||||||
* Keycloak specific local storage for clients. No cache in front, this api talks directly to database configured for Keycloak
|
* Keycloak specific local storage for clients. No cache in front, this api talks directly to database configured for Keycloak
|
||||||
*
|
*
|
||||||
* @return
|
* @deprecated Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
ClientProvider clientLocalStorage();
|
ClientProvider clientLocalStorage();
|
||||||
|
@ -279,8 +281,7 @@ public interface KeycloakSession {
|
||||||
/**
|
/**
|
||||||
* Keycloak specific local storage for client scopes. No cache in front, this api talks directly to database configured for Keycloak
|
* Keycloak specific local storage for client scopes. No cache in front, this api talks directly to database configured for Keycloak
|
||||||
*
|
*
|
||||||
* @deprecated Use {@link #clientScopes()} instead
|
* @deprecated Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.
|
||||||
* @return
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
ClientScopeProvider clientScopeLocalStorage();
|
ClientScopeProvider clientScopeLocalStorage();
|
||||||
|
@ -288,7 +289,7 @@ public interface KeycloakSession {
|
||||||
/**
|
/**
|
||||||
* Keycloak specific local storage for groups. No cache in front, this api talks directly to storage configured for Keycloak
|
* Keycloak specific local storage for groups. No cache in front, this api talks directly to storage configured for Keycloak
|
||||||
*
|
*
|
||||||
* @return
|
* @deprecated Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
GroupProvider groupLocalStorage();
|
GroupProvider groupLocalStorage();
|
||||||
|
@ -296,7 +297,7 @@ public interface KeycloakSession {
|
||||||
/**
|
/**
|
||||||
* Keycloak specific local storage for roles. No cache in front, this api talks directly to storage configured for Keycloak
|
* Keycloak specific local storage for roles. No cache in front, this api talks directly to storage configured for Keycloak
|
||||||
*
|
*
|
||||||
* @return
|
* @deprecated Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
RoleProvider roleLocalStorage();
|
RoleProvider roleLocalStorage();
|
||||||
|
@ -305,7 +306,7 @@ public interface KeycloakSession {
|
||||||
* Hybrid storage for UserStorageProviders that can't store a specific piece of keycloak data in their external storage.
|
* Hybrid storage for UserStorageProviders that can't store a specific piece of keycloak data in their external storage.
|
||||||
* No cache in front.
|
* No cache in front.
|
||||||
*
|
*
|
||||||
* @return
|
* @deprecated Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
UserFederatedStorageProvider userFederatedStorage();
|
UserFederatedStorageProvider userFederatedStorage();
|
||||||
|
|
|
@ -176,78 +176,67 @@ public class DefaultKeycloakSession implements KeycloakSession {
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public UserProvider userLocalStorage() {
|
public UserProvider userLocalStorage() {
|
||||||
log.warnf("The semantics of this method have changed: Please see the migration guide on how to migrate.%s", StackUtil.getShortStackTrace());
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
return users();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public RealmProvider realmLocalStorage() {
|
public RealmProvider realmLocalStorage() {
|
||||||
return realms();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ClientProvider clientLocalStorage() {
|
public ClientProvider clientLocalStorage() {
|
||||||
return clients();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ClientScopeProvider clientScopeLocalStorage() {
|
public ClientScopeProvider clientScopeLocalStorage() {
|
||||||
return clientScopes();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public GroupProvider groupLocalStorage() {
|
public GroupProvider groupLocalStorage() {
|
||||||
return groups();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ClientProvider clientStorageManager() {
|
public ClientProvider clientStorageManager() {
|
||||||
return clients();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public ClientScopeProvider clientScopeStorageManager() {
|
public ClientScopeProvider clientScopeStorageManager() {
|
||||||
return clientScopes();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public RoleProvider roleLocalStorage() {
|
public RoleProvider roleLocalStorage() {
|
||||||
return roles();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public RoleProvider roleStorageManager() {
|
public RoleProvider roleStorageManager() {
|
||||||
return roles();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public GroupProvider groupStorageManager() {
|
public GroupProvider groupStorageManager() {
|
||||||
return groups();
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ThreadLocal<Boolean> recursionPreventionUserStorageManager = new ThreadLocal<>();
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public UserProvider userStorageManager() {
|
public UserProvider userStorageManager() {
|
||||||
if(recursionPreventionUserStorageManager.get() != null) {
|
throw new IllegalStateException("Access to the legacy store is no longer possible via this method. Adjust your code according to the Keycloak 19 Upgrading Guide.");
|
||||||
throw new IllegalStateException("userStorageManager() is being called recursively. Please adjust your code according to the Keycloak 19 migration guide.");
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
recursionPreventionUserStorageManager.set(Boolean.TRUE);
|
|
||||||
return users();
|
|
||||||
} finally {
|
|
||||||
recursionPreventionUserStorageManager.remove();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in a new issue