when userStorageManager() is called recursively, provided a meaningful exception to the caller.
This commit is contained in:
parent
26198e4b0b
commit
3fe477885c
1 changed files with 11 additions and 1 deletions
|
@ -230,10 +230,20 @@ public class DefaultKeycloakSession implements KeycloakSession {
|
|||
return groups();
|
||||
}
|
||||
|
||||
private final ThreadLocal<Boolean> recursionPreventionUserStorageManager = new ThreadLocal<>();
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public UserProvider userStorageManager() {
|
||||
return users();
|
||||
if(recursionPreventionUserStorageManager.get() != null) {
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue