public class UserStorageManager extends AbstractStorageManager<UserStorageProvider,UserStorageProviderModel> implements UserProvider.Streams, OnUserCache, OnCreateComponent, OnUpdateComponent
UserProvider.Streamssession| Constructor and Description |
|---|
UserStorageManager(KeycloakSession session) |
| Modifier and Type | Method and Description |
|---|---|
void |
addConsent(RealmModel realm,
String userId,
UserConsentModel consent) |
void |
addFederatedIdentity(RealmModel realm,
UserModel user,
FederatedIdentityModel socialLink) |
UserModel |
addUser(RealmModel realm,
String username)
UserRegistrationProvider methods implementations start here |
UserModel |
addUser(RealmModel realm,
String id,
String username,
boolean addDefaultRoles,
boolean addDefaultRequiredActions)
UserStorageProvider methods implementation end here
UserProvider methods implementations start here -> no StorageProviders involved |
void |
close()
UserProvider methods implementations end here |
protected void |
deleteInvalidUser(RealmModel realm,
UserModel user) |
UserConsentModel |
getConsentByClient(RealmModel realm,
String userId,
String clientInternalId) |
Stream<UserConsentModel> |
getConsentsStream(RealmModel realm,
String userId)
Obtains the consents associated with the user identified by the specified
userId. |
Stream<FederatedIdentityModel> |
getFederatedIdentitiesStream(UserModel user,
RealmModel realm)
Obtains the federated identities of the specified user.
|
FederatedIdentityModel |
getFederatedIdentity(UserModel user,
String socialProvider,
RealmModel realm) |
Stream<UserModel> |
getGroupMembersStream(RealmModel realm,
GroupModel group)
UserLookupProvider methods implementations end here
UserQueryProvider methods implementation start here |
Stream<UserModel> |
getGroupMembersStream(RealmModel realm,
GroupModel group,
Integer firstResult,
Integer maxResults)
Obtains users that belong to a specific group.
|
int |
getNotBeforeOfUser(RealmModel realm,
UserModel user) |
Stream<UserModel> |
getRoleMembersStream(RealmModel realm,
RoleModel role)
Obtains users that have the specified role.
|
Stream<UserModel> |
getRoleMembersStream(RealmModel realm,
RoleModel role,
Integer firstResult,
Integer maxResults)
Searches for users that have the specified role.
|
UserModel |
getServiceAccount(ClientModel client) |
UserModel |
getUserByEmail(String email,
RealmModel realm) |
UserModel |
getUserByFederatedIdentity(FederatedIdentityModel socialLink,
RealmModel realm) |
UserModel |
getUserById(String id,
RealmModel realm)
UserRegistrationProvider methods implementations end here
UserLookupProvider methods implementations start here |
UserModel |
getUserByUsername(String username,
RealmModel realm) |
int |
getUsersCount(Map<String,String> params,
RealmModel realm)
Returns the number of users that match the given filter parameters.
|
int |
getUsersCount(Map<String,String> params,
RealmModel realm,
Set<String> groupIds)
Returns the number of users that match the given filter parameters and is in
at least one of the given groups.
|
int |
getUsersCount(RealmModel realm)
Returns the number of users, without consider any service account.
|
int |
getUsersCount(RealmModel realm,
boolean includeServiceAccount)
Returns the number of users.
|
int |
getUsersCount(RealmModel realm,
Set<String> groupIds)
Returns the number of users that are in at least one of the groups
given.
|
int |
getUsersCount(String search,
RealmModel realm)
Returns the number of users that match the given criteria.
|
int |
getUsersCount(String search,
RealmModel realm,
Set<String> groupIds)
Returns the number of users that match the given criteria and are in
at least one of the groups given.
|
Stream<UserModel> |
getUsersStream(RealmModel realm)
Searches all users in the realm.
|
Stream<UserModel> |
getUsersStream(RealmModel realm,
boolean includeServiceAccounts)
Obtains the users associated with the specified realm.
|
Stream<UserModel> |
getUsersStream(RealmModel realm,
Integer firstResult,
Integer maxResults,
boolean includeServiceAccounts)
Obtains the users associated with the specified realm.
|
Stream<UserModel> |
getUsersStream(RealmModel realm,
int firstResult,
int maxResults)
Searches all users in the realm, starting from the
firstResult and containing at most maxResults. |
void |
grantToAllUsers(RealmModel realm,
RoleModel role)
UserQueryProvider methods implementation end here
UserBulkUpdateProvider methods implementation start here |
protected Stream<UserModel> |
importValidation(RealmModel realm,
Stream<UserModel> users) |
protected UserModel |
importValidation(RealmModel realm,
UserModel user)
Allows a UserStorageProvider to proxy and/or synchronize an imported user.
|
protected UserProvider |
localStorage() |
void |
onCache(RealmModel realm,
CachedUserModel user,
UserModel delegate) |
void |
onCreate(KeycloakSession session,
RealmModel realm,
ComponentModel model) |
void |
onUpdate(KeycloakSession session,
RealmModel realm,
ComponentModel oldModel,
ComponentModel newModel) |
void |
preRemove(ClientScopeModel clientScope) |
void |
preRemove(ProtocolMapperModel protocolMapper) |
void |
preRemove(RealmModel realm)
UserBulkUpdateProvider methods implementation end here
UserStorageProvider methods implementations start here -> no StorageProviders involved |
void |
preRemove(RealmModel realm,
ClientModel client) |
void |
preRemove(RealmModel realm,
ComponentModel component) |
void |
preRemove(RealmModel realm,
GroupModel group) |
void |
preRemove(RealmModel realm,
IdentityProviderModel provider) |
void |
preRemove(RealmModel realm,
RoleModel role) |
protected Stream<UserModel> |
query(org.keycloak.storage.UserStorageManager.PaginatedQuery pagedQuery,
RealmModel realm,
int firstResult,
int maxResults) |
boolean |
removeFederatedIdentity(RealmModel realm,
UserModel user,
String socialProvider) |
void |
removeImportedUsers(RealmModel realm,
String storageProviderId)
Removes any imported users from a specific User Storage Provider.
|
boolean |
removeUser(RealmModel realm,
UserModel user)
Called if user originated from this provider.
|
boolean |
revokeConsentForClient(RealmModel realm,
String userId,
String clientInternalId) |
Stream<UserModel> |
searchForUserByUserAttributeStream(String attrName,
String attrValue,
RealmModel realm)
Searches for users that have a specific attribute with a specific value.
|
Stream<UserModel> |
searchForUserStream(Map<String,String> attributes,
RealmModel realm)
Searches for user by parameter.
|
Stream<UserModel> |
searchForUserStream(Map<String,String> attributes,
RealmModel realm,
Integer firstResult,
Integer maxResults)
Searches for user by parameter.
|
Stream<UserModel> |
searchForUserStream(String search,
RealmModel realm)
Searches for users with username, email or first + last name that is like search string.
|
Stream<UserModel> |
searchForUserStream(String search,
RealmModel realm,
Integer firstResult,
Integer maxResults)
Searches for users with username, email or first + last name that is like search string.
|
void |
setNotBeforeForUser(RealmModel realm,
UserModel user,
int notBefore) |
void |
unlinkUsers(RealmModel realm,
String storageProviderId)
Set federation link to null to imported users of a specific User Storage Provider
|
void |
updateConsent(RealmModel realm,
String userId,
UserConsentModel consent) |
void |
updateFederatedIdentity(RealmModel realm,
UserModel federatedUser,
FederatedIdentityModel federatedIdentityModel) |
consumeEnabledStorageProvidersWithTimeout, flatMapEnabledStorageProvidersWithTimeout, getEnabledStorageProviders, getStorageProviderFactory, getStorageProviderInstance, getStorageProviderInstance, getStorageProviderInstance, getStorageProviderInstance, getStorageProviderModel, getStorageProviderModels, getStorageProviderTimeout, mapEnabledStorageProvidersWithTimeoutclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetConsents, getFederatedIdentities, getUsers, getUsersgetGroupMembers, getGroupMembers, getUsers, getUsers, searchForUser, searchForUser, searchForUser, searchForUser, searchForUserByUserAttributecountUsersInGroups, getRoleMembers, getRoleMemberspublic UserStorageManager(KeycloakSession session)
protected UserProvider localStorage()
protected UserModel importValidation(RealmModel realm, UserModel user)
realm - user - protected void deleteInvalidUser(RealmModel realm, UserModel user)
protected Stream<UserModel> importValidation(RealmModel realm, Stream<UserModel> users)
protected Stream<UserModel> query(org.keycloak.storage.UserStorageManager.PaginatedQuery pagedQuery, RealmModel realm, int firstResult, int maxResults)
public UserModel addUser(RealmModel realm, String username)
UserRegistrationProvider methods implementations start hereaddUser in interface UserRegistrationProviderpublic boolean removeUser(RealmModel realm, UserModel user)
UserRegistrationProviderremoveUser in interface UserRegistrationProviderpublic UserModel getUserById(String id, RealmModel realm)
UserRegistrationProvider methods implementations end here
UserLookupProvider methods implementations start heregetUserById in interface UserLookupProviderpublic UserModel getUserByUsername(String username, RealmModel realm)
getUserByUsername in interface UserLookupProviderpublic UserModel getUserByEmail(String email, RealmModel realm)
getUserByEmail in interface UserLookupProviderpublic Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group)
UserLookupProvider methods implementations end here
UserQueryProvider methods implementation start heregetGroupMembersStream in interface UserQueryProvidergetGroupMembersStream in interface UserQueryProvider.Streamsrealm - a reference to the realm.group - a reference to the group.Stream of users that belong to the group.UserFederatedStorageProviderpublic Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults)
UserQueryProviderUserFederatedStorageProvider
as this is done automatically.getGroupMembersStream in interface UserQueryProvidergetGroupMembersStream in interface UserQueryProvider.Streamsrealm - a reference to the realm.group - a reference to the group.firstResult - first result to return. Ignored if negative.maxResults - maximum number of results to return. Ignored if negative.Stream of users that belong to the group.UserFederatedStorageProviderpublic Stream<UserModel> getRoleMembersStream(RealmModel realm, RoleModel role)
UserQueryProvidergetRoleMembersStream in interface UserQueryProviderrealm - a reference to the realm.role - a reference to the role.Stream of users that have the specified role.public Stream<UserModel> getRoleMembersStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults)
UserQueryProvidergetRoleMembersStream in interface UserQueryProviderrealm - a reference to the realm.role - a reference to the role.firstResult - first result to return. Ignored if negative.maxResults - maximum number of results to return. Ignored if negative.Stream of users that have the specified role.public Stream<UserModel> getUsersStream(RealmModel realm)
UserQueryProvidergetUsersStream in interface UserQueryProvidergetUsersStream in interface UserQueryProvider.Streamsrealm - a reference to the realm.Stream of users.public Stream<UserModel> getUsersStream(RealmModel realm, int firstResult, int maxResults)
UserQueryProviderfirstResult and containing at most maxResults.getUsersStream in interface UserQueryProvidergetUsersStream in interface UserQueryProvider.Streamsrealm - a reference to the realm.firstResult - first result to return. Ignored if negative.maxResults - maximum number of results to return. Ignored if negative.Stream of users.public Stream<UserModel> getUsersStream(RealmModel realm, boolean includeServiceAccounts)
UserProvidergetUsersStream in interface UserProvidergetUsersStream in interface UserProvider.Streamsrealm - a reference to the realm being used for the search.includeServiceAccounts - true if service accounts should be included in the result; false otherwise.Stream of users associated withe the realm.public Stream<UserModel> getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults, boolean includeServiceAccounts)
UserProvidergetUsersStream in interface UserProvidergetUsersStream in interface UserProvider.Streamsrealm - a reference to the realm being used for the search.firstResult - first result to return. Ignored if negative.maxResults - maximum number of results to return. Ignored if negative.includeServiceAccounts - true if service accounts should be included in the result; false otherwise.Stream of users associated withe the realm.public int getUsersCount(RealmModel realm, boolean includeServiceAccount)
UserQueryProvidergetUsersCount in interface UserQueryProviderrealm - the realmincludeServiceAccount - if true, the number of users will also include service accounts. Otherwise, only the number of users.public int getUsersCount(RealmModel realm)
UserQueryProvidergetUsersCount in interface UserQueryProviderrealm - the realmpublic int getUsersCount(RealmModel realm, Set<String> groupIds)
UserQueryProvidergetUsersCount in interface UserQueryProviderrealm - the realmgroupIds - set of groups id to check forpublic int getUsersCount(String search, RealmModel realm)
UserQueryProvidergetUsersCount in interface UserQueryProvidersearch - search criteriarealm - the realmpublic int getUsersCount(String search, RealmModel realm, Set<String> groupIds)
UserQueryProvidergetUsersCount in interface UserQueryProvidersearch - search criteriarealm - the realmgroupIds - set of groups to check forpublic int getUsersCount(Map<String,String> params, RealmModel realm)
UserQueryProvidergetUsersCount in interface UserQueryProviderparams - filter parametersrealm - the realmpublic int getUsersCount(Map<String,String> params, RealmModel realm, Set<String> groupIds)
UserQueryProvidergetUsersCount in interface UserQueryProviderparams - filter parametersrealm - the realmgroupIds - set if groups to check forpublic Stream<UserModel> searchForUserStream(String search, RealmModel realm)
UserQueryProvidersearchForUserStream in interface UserQueryProvidersearchForUserStream in interface UserQueryProvider.Streamssearch - case sensitive search string.realm - a reference to the realm.Stream of users that match the search string.public Stream<UserModel> searchForUserStream(String search, RealmModel realm, Integer firstResult, Integer maxResults)
UserQueryProvidersearchForUserStream in interface UserQueryProvidersearchForUserStream in interface UserQueryProvider.Streamssearch - case sensitive search string.realm - a reference to the realm.firstResult - first result to return. Ignored if negative.maxResults - maximum number of results to return. Ignored if negative.Stream of users that match the search criteria.public Stream<UserModel> searchForUserStream(Map<String,String> attributes, RealmModel realm)
UserQueryProvidersearchForUserStream in interface UserQueryProvidersearchForUserStream in interface UserQueryProvider.Streamsattributes - a map containing the search parameters.realm - a reference to the realm.Stream of users that match the search parameters.public Stream<UserModel> searchForUserStream(Map<String,String> attributes, RealmModel realm, Integer firstResult, Integer maxResults)
UserQueryProvidersearchForUserStream in interface UserQueryProvidersearchForUserStream in interface UserQueryProvider.Streamsattributes - a map containing the search parameters.realm - a reference to the realm.firstResult - first result to return. Ignored if negative.maxResults - maximum number of results to return. Ignored if negative.Stream of users that match the search criteria.public Stream<UserModel> searchForUserByUserAttributeStream(String attrName, String attrValue, RealmModel realm)
UserQueryProviderUserFederatedStorageProvider as this is done automatically.searchForUserByUserAttributeStream in interface UserQueryProvidersearchForUserByUserAttributeStream in interface UserQueryProvider.StreamsattrName - the attribute name.attrValue - the attribute value.realm - a reference to the realm.Stream of users that match the search criteria.UserFederatedStorageProviderpublic void grantToAllUsers(RealmModel realm, RoleModel role)
UserQueryProvider methods implementation end here
UserBulkUpdateProvider methods implementation start heregrantToAllUsers in interface UserBulkUpdateProviderrealm - Realmrole - Role to be grantedpublic void preRemove(RealmModel realm)
UserBulkUpdateProvider methods implementation end here
UserStorageProvider methods implementations start here -> no StorageProviders involvedpreRemove in interface UserProviderpublic void preRemove(RealmModel realm, GroupModel group)
preRemove in interface UserProviderpublic void preRemove(RealmModel realm, RoleModel role)
preRemove in interface UserProviderpublic UserModel addUser(RealmModel realm, String id, String username, boolean addDefaultRoles, boolean addDefaultRequiredActions)
UserStorageProvider methods implementation end here
UserProvider methods implementations start here -> no StorageProviders involvedaddUser in interface UserProviderpublic void addFederatedIdentity(RealmModel realm, UserModel user, FederatedIdentityModel socialLink)
addFederatedIdentity in interface UserProviderpublic void updateFederatedIdentity(RealmModel realm, UserModel federatedUser, FederatedIdentityModel federatedIdentityModel)
updateFederatedIdentity in interface UserProviderpublic boolean removeFederatedIdentity(RealmModel realm, UserModel user, String socialProvider)
removeFederatedIdentity in interface UserProviderpublic void preRemove(RealmModel realm, IdentityProviderModel provider)
preRemove in interface UserProviderpublic void addConsent(RealmModel realm, String userId, UserConsentModel consent)
addConsent in interface UserProviderpublic UserConsentModel getConsentByClient(RealmModel realm, String userId, String clientInternalId)
getConsentByClient in interface UserProviderpublic Stream<UserConsentModel> getConsentsStream(RealmModel realm, String userId)
UserProvideruserId.getConsentsStream in interface UserProvidergetConsentsStream in interface UserProvider.Streamsrealm - a reference to the realm.userId - the user identifier.Stream of consents associated with the user.public void updateConsent(RealmModel realm, String userId, UserConsentModel consent)
updateConsent in interface UserProviderpublic boolean revokeConsentForClient(RealmModel realm, String userId, String clientInternalId)
revokeConsentForClient in interface UserProviderpublic void setNotBeforeForUser(RealmModel realm, UserModel user, int notBefore)
setNotBeforeForUser in interface UserProviderpublic int getNotBeforeOfUser(RealmModel realm, UserModel user)
getNotBeforeOfUser in interface UserProviderpublic UserModel getUserByFederatedIdentity(FederatedIdentityModel socialLink, RealmModel realm)
getUserByFederatedIdentity in interface UserProviderpublic UserModel getServiceAccount(ClientModel client)
getServiceAccount in interface UserProviderpublic Stream<FederatedIdentityModel> getFederatedIdentitiesStream(UserModel user, RealmModel realm)
UserProvidergetFederatedIdentitiesStream in interface UserProvidergetFederatedIdentitiesStream in interface UserProvider.Streamsuser - a reference to the user.realm - a reference to the realm.Stream of federated identities associated with the user.public FederatedIdentityModel getFederatedIdentity(UserModel user, String socialProvider, RealmModel realm)
getFederatedIdentity in interface UserProviderpublic void preRemove(RealmModel realm, ClientModel client)
preRemove in interface UserProviderpublic void preRemove(ProtocolMapperModel protocolMapper)
preRemove in interface UserProviderpublic void preRemove(ClientScopeModel clientScope)
preRemove in interface UserProviderpublic void preRemove(RealmModel realm, ComponentModel component)
preRemove in interface UserProviderpublic void removeImportedUsers(RealmModel realm, String storageProviderId)
UserProviderremoveImportedUsers in interface UserProviderpublic void unlinkUsers(RealmModel realm, String storageProviderId)
UserProviderunlinkUsers in interface UserProviderpublic void close()
UserProvider methods implementations end hereclose in interface UserProviderclose in interface Providerpublic void onCreate(KeycloakSession session, RealmModel realm, ComponentModel model)
onCreate in interface OnCreateComponentpublic void onUpdate(KeycloakSession session, RealmModel realm, ComponentModel oldModel, ComponentModel newModel)
onUpdate in interface OnUpdateComponentpublic void onCache(RealmModel realm, CachedUserModel user, UserModel delegate)
onCache in interface OnUserCacheCopyright © 2021 JBoss by Red Hat. All rights reserved.