mirror of
https://github.com/keycloak/keycloak.git
synced 2026-01-09 23:12:06 -03:30
Document missing artifact dependency for UserStoragePrivateUtil
Closes #43212 Signed-off-by: Martin Kanis <mkanis@redhat.com> Co-authored-by: Martin Kanis <mkanis@redhat.com>
This commit is contained in:
parent
0a05348ab6
commit
8aada2c8e2
@ -30,9 +30,10 @@ begin first by modifying the `createAdapter()` method.
|
||||
[source,java]
|
||||
----
|
||||
protected UserModel createAdapter(RealmModel realm, String username) {
|
||||
UserModel local = UserStoragePrivateUtil.userLocalStorage(session).getUserByUsername(realm, username);
|
||||
UserProvider userProvider = session.getProvider(UserProvider.class);
|
||||
UserModel local = userProvider.getUserByUsername(realm, username);
|
||||
if (local == null) {
|
||||
local = UserStoragePrivateUtil.userLocalStorage(session).addUser(realm, username);
|
||||
local = userProvider.addUser(realm, username);
|
||||
local.setFederationLink(model.getId());
|
||||
}
|
||||
return new UserModelDelegate(local) {
|
||||
@ -49,7 +50,7 @@ begin first by modifying the `createAdapter()` method.
|
||||
}
|
||||
----
|
||||
|
||||
In this method we call the `UserStoragePrivateUtil.userLocalStorage(session)` method to obtain a reference to local {project_name}
|
||||
In this method we call `session.getProvider(UserProvider.class)` to obtain a reference to local {project_name}
|
||||
user storage. We see if the user is stored locally, if not, we add it locally. Do not set the `id` of the local user.
|
||||
Let {project_name} automatically generate the `id`. Also note that we call
|
||||
`UserModel.setFederationLink()` and pass in the ID of the `ComponentModel` of our provider. This sets a link between
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user