Class UserCacheSession
java.lang.Object
org.keycloak.models.cache.infinispan.UserCacheSession
- All Implemented Interfaces:
UserCache
,UserProvider
,Provider
,OnCreateComponent
,OnUpdateComponent
,UserBulkUpdateProvider
,UserCountMethodsProvider
,UserLookupProvider
,UserQueryMethodsProvider
,UserQueryProvider
,UserRegistrationProvider
,UserProfileDecorator
public class UserCacheSession
extends Object
implements UserCache, OnCreateComponent, OnUpdateComponent, UserProfileDecorator
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
Modifier and TypeFieldDescriptionprotected UserCacheManager
protected UserProvider
protected Set<InvalidationEvent>
protected static final org.jboss.logging.Logger
protected KeycloakSession
protected boolean
protected final long
protected boolean
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addConsent
(RealmModel realm, String userId, UserConsentModel consent) Add user consent for the user.void
addFederatedIdentity
(RealmModel realm, UserModel user, FederatedIdentityModel socialLink) Adds a federated identity link for the user within the realmaddUser
(RealmModel realm, String username) All storage providers that implement this interface will be looped through.addUser
(RealmModel realm, String id, String username, boolean addDefaultRoles, boolean addDefaultRequiredActions) Adds a new user into the storage.protected UserModel
cacheUser
(RealmModel realm, UserModel delegate, Long revision) void
clear()
Clear cache entirely.void
close()
decorateUserProfile
(String providerId, UserProfileMetadata metadata) Decorates user profile with additional metadata.void
evict
(RealmModel realm) Evict users of a specific realmvoid
evict
(RealmModel realm, UserModel user) Evict user from cache.findServiceAccount
(ClientModel client) protected void
fullyInvalidateUser
(RealmModel realm, UserModel user) getConsentByClient
(RealmModel realm, String userId, String clientId) Returns UserConsentModel given by a user with the userId for the client with clientInternalIdgetConsentsStream
(RealmModel realm, String userId) Obtains the consents associated with the user identified by the specifieduserId
.getFederatedIdentitiesStream
(RealmModel realm, UserModel user) Obtains the federated identities of the specified user.getFederatedIdentity
(RealmModel realm, UserModel user, String socialProvider) Returns details of the association between the user and the socialProvider.getGroupMembersStream
(RealmModel realm, GroupModel group) Obtains users that belong to a specific group.getGroupMembersStream
(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults) Obtains users that belong to a specific group.getGroupMembersStream
(RealmModel realm, GroupModel group, String search, Boolean exact, Integer firstResult, Integer maxResults) Obtains users that belong to a specific group, filtered according to the search parameters.int
getNotBeforeOfUser
(RealmModel realm, UserModel user) Gets the notBefore value for the given usergetRoleMembersStream
(RealmModel realm, RoleModel role) Obtains users that have the specified role.getRoleMembersStream
(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) Searches for users that have the specified role.getServiceAccount
(ClientModel client) Return a UserModel representing service account of the clientprotected UserModel
getUserAdapter
(RealmModel realm, String userId, Long loaded, UserModel delegate) getUserByCredential
(RealmModel realm, CredentialInput input) getUserByEmail
(RealmModel realm, String email) Returns a user with the given email belonging to the realmgetUserByFederatedIdentity
(RealmModel realm, FederatedIdentityModel socialLink) Returns a userModel that corresponds to the given socialLink.getUserById
(RealmModel realm, String id) Returns a user with the given id belonging to the realmgetUserByUsername
(RealmModel realm, String username) Exact search for a user by its username.int
getUsersCount
(RealmModel realm, boolean includeServiceAccount) Returns the number of users.int
getUsersCount
(RealmModel realm, String search) Returns the number of users that would be returned by a call tosearchForUserStream
int
getUsersCount
(RealmModel realm, String search, Set<String> groupIds) Returns the number of users that would be returned by a call tosearchForUserStream
and are members of at least one of the groups given by thegroupIds
set.int
getUsersCount
(RealmModel realm, Map<String, String> params) Returns the number of users that match the given filter parameters.int
getUsersCount
(RealmModel realm, Map<String, String> params, 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, Set<String> groupIds) Returns the number of users that are in at least one of the groups given.void
grantToAllUsers
(RealmModel realm, RoleModel role) Grants the given role to all users from particular realm.void
onCreate
(KeycloakSession session, RealmModel realm, ComponentModel model) void
onUpdate
(KeycloakSession session, RealmModel realm, ComponentModel oldModel, ComponentModel newModel) void
preRemove
(ClientScopeModel clientScope) Called when a client scope is removed.void
preRemove
(ProtocolMapperModel protocolMapper) Called when a protocolMapper is removedvoid
preRemove
(RealmModel realm) Called when a realm is removed.void
preRemove
(RealmModel realm, ComponentModel component) Called when a component is removed.void
preRemove
(RealmModel realm, ClientModel client) Called when a client is removed.void
preRemove
(RealmModel realm, GroupModel group) Called when a group is removed.void
preRemove
(RealmModel realm, IdentityProviderModel provider) Called when an identity provider is removed.void
preRemove
(RealmModel realm, RoleModel role) Called when a role is removed.void
boolean
removeFederatedIdentity
(RealmModel realm, UserModel user, String socialProvider) Removes federation link between the user and the identity provider given by its idvoid
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) Remove a user consent given by the user id and client idprotected void
searchForUserByUserAttributeStream
(RealmModel realm, String attrName, String attrValue) Searches for users that have a specific attribute with a specific value.searchForUserStream
(RealmModel realm, String search) Searches for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace.searchForUserStream
(RealmModel realm, String search, Integer firstResult, Integer maxResults) Searches for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace.searchForUserStream
(RealmModel realm, Map<String, String> attributes) Searches for user by parameter.searchForUserStream
(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) Searches for user by parameter.void
setNotBeforeForUser
(RealmModel realm, UserModel user, int notBefore) Sets the notBefore value for the given uservoid
unlinkUsers
(RealmModel realm, String storageProviderId) Set federation link tonull
to imported users of a specific User Storage Providervoid
updateConsent
(RealmModel realm, String userId, UserConsentModel consent) Update client scopes in the stored user consentvoid
updateFederatedIdentity
(RealmModel realm, UserModel federatedUser, FederatedIdentityModel federatedIdentityModel) Update details of association between the federatedUser and the idp given by the federatedIdentityModelprotected UserModel
validateCache
(RealmModel realm, CachedUser cached) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.keycloak.storage.user.UserCountMethodsProvider
getUsersCount
-
Field Details
-
logger
protected static final org.jboss.logging.Logger logger -
cache
-
session
-
delegate
-
transactionActive
protected boolean transactionActive -
setRollbackOnly
protected boolean setRollbackOnly -
startupRevision
protected final long startupRevision -
invalidations
-
realmInvalidations
-
invalidationEvents
-
managedUsers
-
-
Constructor Details
-
UserCacheSession
-
-
Method Details
-
clear
public void clear()Description copied from interface:UserCache
Clear cache entirely. -
getDelegate
-
registerUserInvalidation
-
evict
Description copied from interface:UserCache
Evict user from cache. -
evict
Description copied from interface:UserCache
Evict users of a specific realm -
runInvalidations
protected void runInvalidations() -
getUserById
Description copied from interface:UserLookupProvider
Returns a user with the given id belonging to the realm- Specified by:
getUserById
in interfaceUserLookupProvider
- Parameters:
realm
- the realm modelid
- id of the user- Returns:
- found user model, or
null
if no such user exists
-
getUserByUsername
Description copied from interface:UserLookupProvider
Exact search for a user by its username. Returns a user with the given username belonging to the realm- Specified by:
getUserByUsername
in interfaceUserLookupProvider
- Parameters:
realm
- the realm modelusername
- (case-sensitivity is controlled by storage)- Returns:
- found user model, or
null
if no such user exists
-
getUserAdapter
protected UserModel getUserAdapter(RealmModel realm, String userId, Long loaded, UserModel delegate) -
validateCache
-
cacheUser
-
getUserByEmail
Description copied from interface:UserLookupProvider
Returns a user with the given email belonging to the realm- Specified by:
getUserByEmail
in interfaceUserLookupProvider
- Parameters:
realm
- the realm modelemail
- email address- Returns:
- found user model, or
null
if no such user exists
-
close
public void close() -
getUserByFederatedIdentity
Description copied from interface:UserProvider
Returns a userModel that corresponds to the given socialLink.- Specified by:
getUserByFederatedIdentity
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmsocialLink
- the socialLink- Returns:
- the user corresponding to socialLink and
null
if no such user exists
-
getGroupMembersStream
public Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProvider
Obtains users that belong to a specific group.- Specified by:
getGroupMembersStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.group
- a reference to the group.firstResult
- first result to return. Ignored if negative, zero, ornull
.maxResults
- maximum number of results to return. Ignored if negative ornull
.- Returns:
- a non-null
Stream
of users that belong to the group.
-
getGroupMembersStream
public Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group, String search, Boolean exact, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProvider
Obtains users that belong to a specific group, filtered according to the search parameters.- Specified by:
getGroupMembersStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.group
- a reference to the group.search
- the search string. It can represent either the user's username, e-mail, first name, or last name.exact
- a boolean indicating if the search should be exact or not. Iftrue
, it selects only users whose main attributes (username, e-mail, first name, or last name) exactly match the search string. Iffalse
, it selects the users whose main attributes partially match the search string.firstResult
- the position of the first result to be processed (pagination offset). Ignored if negative ornull
.maxResults
- the maximum number of results to be returned. Ignored if negative ornull
.- Returns:
- a non-null
Stream
of filtered users that belong to the group.
-
getGroupMembersStream
Description copied from interface:UserQueryMethodsProvider
Obtains users that belong to a specific group.- Specified by:
getGroupMembersStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.group
- a reference to the group.- Returns:
- a non-null
Stream
of users that belong to the group.
-
getRoleMembersStream
public Stream<UserModel> getRoleMembersStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProvider
Searches for users that have the specified role.- Specified by:
getRoleMembersStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.role
- a reference to the role.firstResult
- first result to return. Ignored if negative ornull
.maxResults
- maximum number of results to return. Ignored if negative ornull
.- Returns:
- a non-null
Stream
of users that have the specified role.
-
getRoleMembersStream
Description copied from interface:UserQueryMethodsProvider
Obtains users that have the specified role.- Specified by:
getRoleMembersStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.role
- a reference to the role.- Returns:
- a non-null
Stream
of users that have the specified role.
-
getServiceAccount
Description copied from interface:UserProvider
Return a UserModel representing service account of the client- Specified by:
getServiceAccount
in interfaceUserProvider
- Parameters:
client
- the client model- Returns:
- userModel representing service account of the client
-
findServiceAccount
-
getUserByCredential
- Specified by:
getUserByCredential
in interfaceUserLookupProvider
-
getUsersCount
Description copied from interface:UserCountMethodsProvider
Returns the number of users.- Specified by:
getUsersCount
in interfaceUserCountMethodsProvider
- Parameters:
realm
- the realmincludeServiceAccount
- if true, the number of users will also include service accounts. Otherwise, only the number of users.- Returns:
- the number of users
-
getUsersCount
Description copied from interface:UserCountMethodsProvider
Returns the number of users that are in at least one of the groups given.- Specified by:
getUsersCount
in interfaceUserCountMethodsProvider
- Parameters:
realm
- the realmgroupIds
- set of groups IDs, the returned user needs to belong to at least one of them- Returns:
- the number of users that are in at least one of the groups
-
getUsersCount
Description copied from interface:UserCountMethodsProvider
Returns the number of users that would be returned by a call tosearchForUserStream
- Specified by:
getUsersCount
in interfaceUserCountMethodsProvider
- Parameters:
realm
- the realmsearch
- case insensitive list of strings separated by whitespaces.- Returns:
- number of users that match the search
-
getUsersCount
Description copied from interface:UserCountMethodsProvider
Returns the number of users that would be returned by a call tosearchForUserStream
and are members of at least one of the groups given by thegroupIds
set.- Specified by:
getUsersCount
in interfaceUserCountMethodsProvider
- Parameters:
realm
- the realmsearch
- case insensitive list of strings separated by whitespaces.groupIds
- set of groups IDs, the returned user needs to belong to at least one of them- Returns:
- number of users that match the search and given groups
-
getUsersCount
Description copied from interface:UserCountMethodsProvider
Returns the number of users that match the given filter parameters.- Specified by:
getUsersCount
in interfaceUserCountMethodsProvider
- Parameters:
realm
- the realmparams
- filter parameters- Returns:
- number of users that match the given filters
-
getUsersCount
Description copied from interface:UserCountMethodsProvider
Returns the number of users that match the given filter parameters and is in at least one of the given groups.- Specified by:
getUsersCount
in interfaceUserCountMethodsProvider
- Parameters:
realm
- the realmparams
- filter parametersgroupIds
- set if groups to check for- Returns:
- number of users that match the given filters and groups
-
searchForUserStream
Description copied from interface:UserQueryMethodsProvider
Searches for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). This method is used by the admin console search box- Specified by:
searchForUserStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.search
- case insensitive list of string separated by whitespaces.- Returns:
- a non-null
Stream
of users that match the search string.
-
searchForUserStream
public Stream<UserModel> searchForUserStream(RealmModel realm, String search, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProvider
Searches for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). This method is used by the admin console search box- Specified by:
searchForUserStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.search
- case insensitive list of string separated by whitespaces.firstResult
- first result to return. Ignored if negative, zero, ornull
.maxResults
- maximum number of results to return. Ignored if negative ornull
.- Returns:
- a non-null
Stream
of users that match the search criteria.
-
searchForUserStream
Description copied from interface:UserQueryMethodsProvider
Searches for user by parameter. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). Valid parameters are:UserModel.SEARCH
- search for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace, whenSEARCH
is set all other params are ignoredUserModel.FIRST_NAME
- first name (case insensitive string)UserModel.LAST_NAME
- last name (case insensitive string)UserModel.EMAIL
- email (case insensitive string)UserModel.USERNAME
- username (case insensitive string)UserModel.EXACT
- whether search with FIRST_NAME, LAST_NAME, USERNAME or EMAIL should be exact matchUserModel.EMAIL_VERIFIED
- search only for users with verified/non-verified email (true/false)UserModel.ENABLED
- search only for enabled/disabled users (true/false)UserModel.IDP_ALIAS
- search only for users that have a federated identity from idp with the given alias configured (case sensitive string)UserModel.IDP_USER_ID
- search for users with federated identity with the given userId (case sensitive string)
Any other parameters will be treated as custom user attributes.
This method is used by the REST API when querying users.
- Specified by:
searchForUserStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.attributes
- a map containing the search parameters.- Returns:
- a non-null
Stream
of users that match the search parameters.
-
searchForUserStream
public Stream<UserModel> searchForUserStream(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProvider
Searches for user by parameter. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). Valid parameters are:UserModel.SEARCH
- search for users whose username, email, first name or last name contain any of the strings insearch
separated by whitespace, whenSEARCH
is set all other params are ignoredUserModel.FIRST_NAME
- first name (case insensitive string)UserModel.LAST_NAME
- last name (case insensitive string)UserModel.EMAIL
- email (case insensitive string)UserModel.USERNAME
- username (case insensitive string)UserModel.EXACT
- whether search with FIRST_NAME, LAST_NAME, USERNAME or EMAIL should be exact matchUserModel.EMAIL_VERIFIED
- search only for users with verified/non-verified email (true/false)UserModel.ENABLED
- search only for enabled/disabled users (true/false)UserModel.IDP_ALIAS
- search only for users that have a federated identity from idp with the given alias configured (case sensitive string)UserModel.IDP_USER_ID
- search for users with federated identity with the given userId (case sensitive string)
Any other parameters will be treated as custom user attributes.
This method is used by the REST API when querying users.
- Specified by:
searchForUserStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.attributes
- a map containing the search parameters.firstResult
- first result to return. Ignored if negative, zero, ornull
.maxResults
- maximum number of results to return. Ignored if negative ornull
.- Returns:
- a non-null
Stream
of users that match the search criteria.
-
searchForUserByUserAttributeStream
public Stream<UserModel> searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue) Description copied from interface:UserQueryMethodsProvider
Searches for users that have a specific attribute with a specific value.- Specified by:
searchForUserByUserAttributeStream
in interfaceUserQueryMethodsProvider
- Parameters:
realm
- a reference to the realm.attrName
- the attribute name.attrValue
- the attribute value.- Returns:
- a non-null
Stream
of users that match the search criteria.
-
getFederatedIdentitiesStream
public Stream<FederatedIdentityModel> getFederatedIdentitiesStream(RealmModel realm, UserModel user) Description copied from interface:UserProvider
Obtains the federated identities of the specified user.- Specified by:
getFederatedIdentitiesStream
in interfaceUserProvider
- Parameters:
realm
- a reference to the realm.user
- the reference to the user.- Returns:
- a non-null
Stream
of federated identities associated with the user.
-
getFederatedIdentity
public FederatedIdentityModel getFederatedIdentity(RealmModel realm, UserModel user, String socialProvider) Description copied from interface:UserProvider
Returns details of the association between the user and the socialProvider.- Specified by:
getFederatedIdentity
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuser
- the user modelsocialProvider
- the id of the identity provider- Returns:
- federatedIdentityModel or
null
if no association exists
-
updateConsent
Description copied from interface:UserProvider
Update client scopes in the stored user consent- Specified by:
updateConsent
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuserId
- id of the userconsent
- new details of the user consent
-
revokeConsentForClient
Description copied from interface:UserProvider
Remove a user consent given by the user id and client id- Specified by:
revokeConsentForClient
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuserId
- id of the userclientInternalId
- id of the client- Returns:
true
if the consent was removed,false
otherwise TODO: Make this method return Boolean so that store can return "I don't know" answer, this can be used for example in async stores
-
addConsent
Description copied from interface:UserProvider
Add user consent for the user.- Specified by:
addConsent
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuserId
- id of the userconsent
- all details corresponding to the granted consent
-
getConsentByClient
Description copied from interface:UserProvider
Returns UserConsentModel given by a user with the userId for the client with clientInternalId- Specified by:
getConsentByClient
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuserId
- id of the userclientId
- id of the client- Returns:
- consent given by the user to the client or
null
if no consent or user exists
-
getConsentsStream
Description copied from interface:UserProvider
Obtains the consents associated with the user identified by the specifieduserId
.- Specified by:
getConsentsStream
in interfaceUserProvider
- Parameters:
realm
- a reference to the realm.userId
- the user identifier.- Returns:
- a non-null
Stream
of consents associated with the user.
-
setNotBeforeForUser
Description copied from interface:UserProvider
Sets the notBefore value for the given user- Specified by:
setNotBeforeForUser
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuser
- the user modelnotBefore
- new value for notBefore
-
getNotBeforeOfUser
Description copied from interface:UserProvider
Gets the notBefore value for the given user- Specified by:
getNotBeforeOfUser
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuser
- the user model- Returns:
- the value of notBefore
-
addUser
public UserModel addUser(RealmModel realm, String id, String username, boolean addDefaultRoles, boolean addDefaultRequiredActions) Description copied from interface:UserProvider
Adds a new user into the storage. only used for local storage- Specified by:
addUser
in interfaceUserProvider
- Parameters:
realm
- the realm that user will be created inid
- id of the new user. Should be generated to a random value ifnull
.username
- usernameaddDefaultRoles
- iftrue
, the user should join all realm default rolesaddDefaultRequiredActions
- iftrue
, all default required actions are added to the created user- Returns:
- model of created user
-
addUser
Description copied from interface:UserRegistrationProvider
All storage providers that implement this interface will be looped through. If this method returns null, then the next storage provider's addUser() method will be called. If no storage providers handle the add, then the user will be created in local storage. Returning null is useful when you want optional support for adding users. For example, our LDAP provider can enable and disable the ability to add users.- Specified by:
addUser
in interfaceUserRegistrationProvider
- Parameters:
realm
- a reference to the realmusername
- a username the created user will be assigned- Returns:
- a model of created user
-
fullyInvalidateUser
-
removeUser
Description copied from interface:UserRegistrationProvider
Called if user originated from this provider. If a local user is linked to this provider, this method will be called before local storage's removeUser() method is invoked. If you are using an import strategy, and this is a local user linked to this provider, this method will be called before local storage's removeUser() method is invoked. Also, you DO NOT need to remove the imported user. The runtime will handle this for you.- Specified by:
removeUser
in interfaceUserRegistrationProvider
- Parameters:
realm
- a reference to the realmuser
- a reference to the user that is removed- Returns:
- true if the user was removed, false otherwise
-
addFederatedIdentity
public void addFederatedIdentity(RealmModel realm, UserModel user, FederatedIdentityModel socialLink) Description copied from interface:UserProvider
Adds a federated identity link for the user within the realm- Specified by:
addFederatedIdentity
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuser
- the user modelsocialLink
- the federated identity model containing all details of the association between the user and the identity provider
-
updateFederatedIdentity
public void updateFederatedIdentity(RealmModel realm, UserModel federatedUser, FederatedIdentityModel federatedIdentityModel) Description copied from interface:UserProvider
Update details of association between the federatedUser and the idp given by the federatedIdentityModel- Specified by:
updateFederatedIdentity
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmfederatedUser
- the user modelfederatedIdentityModel
- the federated identity model containing all details of the association between the user and the identity provider
-
removeFederatedIdentity
Description copied from interface:UserProvider
Removes federation link between the user and the identity provider given by its id- Specified by:
removeFederatedIdentity
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmuser
- the user modelsocialProvider
- alias of the identity provider, seeIdentityProviderModel.getAlias()
- Returns:
true
if the association was removed,false
otherwise TODO: Make this method return Boolean so that store can return "I don't know" answer, this can be used for example in async stores
-
preRemove
Description copied from interface:UserProvider
Called when an identity provider is removed. Should remove all federated identities assigned to users from the provider.- Specified by:
preRemove
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmprovider
- provider model
-
grantToAllUsers
Description copied from interface:UserBulkUpdateProvider
Grants the given role to all users from particular realm. The role has to belong to the realm.- Specified by:
grantToAllUsers
in interfaceUserBulkUpdateProvider
- Parameters:
realm
- Realmrole
- Role to be granted
-
preRemove
Description copied from interface:UserProvider
Called when a realm is removed. Should remove all users that belong to the realm.- Specified by:
preRemove
in interfaceUserProvider
- Parameters:
realm
- a reference to the realm
-
preRemove
Description copied from interface:UserProvider
Called when a role is removed. Should remove the role membership for each user.- Specified by:
preRemove
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmrole
- the role model
-
preRemove
Description copied from interface:UserProvider
Called when a group is removed. Should remove the group membership for each user.- Specified by:
preRemove
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmgroup
- the group model
-
preRemove
Description copied from interface:UserProvider
Called when a client is removed. Should remove all user consents associated with the client- Specified by:
preRemove
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmclient
- the client model
-
preRemove
Description copied from interface:UserProvider
Called when a protocolMapper is removed- Specified by:
preRemove
in interfaceUserProvider
- Parameters:
protocolMapper
- the protocolMapper model
-
preRemove
Description copied from interface:UserProvider
Called when a client scope is removed. Should remove the clientScope from each user consent- Specified by:
preRemove
in interfaceUserProvider
- Parameters:
clientScope
- the clientScope model
-
preRemove
Description copied from interface:UserProvider
Called when a component is removed. Should remove all data in UserStorage associated with removed component. For example,- if component corresponds to UserStorageProvider all imported users from the provider should be removed,
- if component corresponds to ClientStorageProvider all consents granted for clients imported from the provider should be removed
- Specified by:
preRemove
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmcomponent
- the component model
-
removeImportedUsers
Description copied from interface:UserProvider
Removes any imported users from a specific User Storage Provider.- Specified by:
removeImportedUsers
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmstorageProviderId
- id of the user storage provider
-
unlinkUsers
Description copied from interface:UserProvider
Set federation link tonull
to imported users of a specific User Storage Provider- Specified by:
unlinkUsers
in interfaceUserProvider
- Parameters:
realm
- a reference to the realmstorageProviderId
- id of the storage provider
-
onUpdate
public void onUpdate(KeycloakSession session, RealmModel realm, ComponentModel oldModel, ComponentModel newModel) - Specified by:
onUpdate
in interfaceOnUpdateComponent
-
onCreate
- Specified by:
onCreate
in interfaceOnCreateComponent
-
decorateUserProfile
Description copied from interface:UserProfileDecorator
Decorates user profile with additional metadata. For instance, metadata attributes, which are available just for your user-storage provider can be added there, so they are available just for the users coming from your provider.
This method is invoked every time a user is being managed through a user profile provider.
- Specified by:
decorateUserProfile
in interfaceUserProfileDecorator
- Parameters:
providerId
- the id of the user storage provider to which the user is associated withmetadata
- the currentUserProfileMetadata
for the current realm- Returns:
- a list of attribute metadata.The
AttributeMetadata
returned from this method overrides any other metadata already set inmetadata
for a given attribute.
-