Clean-up of deprecated methods and interfaces

Fixes #20877

Co-authored-by: andymunro <48995441+andymunro@users.noreply.github.com>
This commit is contained in:
Vlasta Ramik
2023-06-09 19:11:20 +02:00
committed by GitHub
parent fbfdb54745
commit ed473da22b
46 changed files with 119 additions and 941 deletions

View File

@@ -26,47 +26,14 @@ public interface UserFederatedStorageProvider extends Provider,
UserFederatedUserCredentialStore {
...
Stream<GroupModel> getGroupsStream(RealmModel realm, String userId)
void joinGroup(RealmModel realm, String userId, GroupModel group);
void leaveGroup(RealmModel realm, String userId, GroupModel group);
Stream<String> getMembershipStream(RealmModel realm, GroupModel group, Integer firstResult, Integer max);
...
interface Streams extends UserFederatedStorageProvider,
UserAttributeFederatedStorage.Streams,
UserBrokerLinkFederatedStorage.Streams,
UserConsentFederatedStorage.Streams,
UserFederatedUserCredentialStore.Streams,
UserGroupMembershipFederatedStorage.Streams,
UserRequiredActionsFederatedStorage.Streams,
UserRoleMappingsFederatedStorage.Streams {
...
@Override
default List<String> getStoredUsers(RealmModel realm, int first, int max) {
return this.getStoredUsersStream(realm, first, max).collect(Collectors.toList());
}
@Override
Stream<String> getStoredUsersStream(RealmModel realm, Integer first, Integer max);
...
}
}
----
The `UserFederatedStorageProvider` instance is available on the `KeycloakSession.userFederatedStorage()` method.
The `UserFederatedStorageProvider` instance is available on the `UserStorageUtil.userFederatedStorage(KeycloakSession)` method.
It has all different kinds of methods for storing attributes, group and role mappings, different credential types,
and required actions. If your external store's datamodel cannot support the full {project_name} feature
set, then this service can fill in the gaps.
Also, the `UserFederatedStorageProvider.Streams` interface exists. It makes all collection-based methods in `UserFederatedStorageProvider`
default by providing implementations that delegate to the stream-based variants instead of the other way around.
It allows for implementations to focus on the stream-based approach for processing sets of data and benefit
from the potential memory and performance optimizations of that approach. See <<_stream_based_interfaces,Stream-based interfaces>> for more information.
{project_name} comes with a helper class `org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage`
that will delegate every single `UserModel` method except get/set of username to user federated storage. Override
the methods you need to override to delegate to your external storage representations. It is strongly

View File

@@ -334,4 +334,18 @@ If you are extending the server's REST APIs through the following SPIs:
You need to add an empty `META-INF/beans.xml` to the JAR file where your custom providers are packaged. Otherwise, they are not recognized by the server
at runtime.
You should also make sure your JAX-RS methods are declaring the expected media types for input and output by marking them with the `@Consumes` and `@Produces` annotations, respectively.
You should also make sure your JAX-RS methods are declaring the expected media types for input and output by marking them with the `@Consumes` and `@Produces` annotations, respectively.
= Deprecated methods from data providers and models
In earlier versions of Keycloak, provider and model interfaces underwent a cleanup process that involved deprecating certain methods.
In this release the methods were removed and some additional methods were deprecated. The Javadoc for these methods from Keycloak 21 included information about
their corresponding replacements.
* `RealmModel#searchForGroupByNameStream(String, Integer, Integer)` was removed.
* `UserProvider#getUsersStream(RealmModel, boolean)` was removed.
* `UserSessionPersisterProvider#loadUserSessions(int, int, boolean, int, String)` was removed.
* Interfaces added for Streamification work were removed. Such as `RoleMapperModel.Streams` and similar.
* `Streams` interfaces in federated storage provider classes were deprecated.
* `KeycloakModelUtils#getClientScopeMappings` was removed.
* Deprecated methods from `KeycloakSession` were removed.