org.keycloak.models.map.user

## Class MapUserProvider

- java.lang.Object
- - org.keycloak.models.map.user.MapUserProvider

- All Implemented Interfaces:
    UserCredentialStore, UserCredentialStore.Streams, UserProvider, UserProvider.Streams, Provider, UserBulkUpdateProvider, UserLookupProvider, UserLookupProvider.Streams, UserQueryProvider, UserQueryProvider.Streams, UserRegistrationProvider

      public class MapUserProvider
      extends Object
      implements UserProvider.Streams, UserCredentialStore.Streams

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.keycloak.models.UserProvider

      `UserProvider.Streams`

    - ### Nested classes/interfaces inherited from interface org.keycloak.credential.UserCredentialStore

      `UserCredentialStore.Streams`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MapUserProvider(KeycloakSession session, MapStorage<MapUserEntity,UserModel> store)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `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 realm
    `UserModel` | `addUser(RealmModel realm, String username)` All storage providers that implement this interface will be looped through.
    `UserModel` | `addUser(RealmModel realm, String id, String username, boolean addDefaultRoles, boolean addDefaultRequiredActions)` Adds a new user into the storage.
    `void` | `close()`
    `CredentialModel` | `createCredential(RealmModel realm, UserModel user, CredentialModel cred)`
    `UserConsentModel` | `getConsentByClient(RealmModel realm, String userId, String clientInternalId)` Returns UserConsentModel given by a user with the userId for the client with clientInternalId
    `Stream<UserConsentModel>` | `getConsentsStream(RealmModel realm, String userId)` Obtains the consents associated with the user identified by the specified `userId`.
    `Stream<FederatedIdentityModel>` | `getFederatedIdentitiesStream(RealmModel realm, UserModel user)` Obtains the federated identities of the specified user.
    `FederatedIdentityModel` | `getFederatedIdentity(RealmModel realm, UserModel user, String socialProvider)` Returns details of the association between the user and the socialProvider.
    `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)` Gets the notBefore value for the given user
    `Stream<UserModel>` | `getRoleMembersStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults)` Searches for users that have the specified role.
    `UserModel` | `getServiceAccount(ClientModel client)` Return a UserModel representing service account of the client
    `CredentialModel` | `getStoredCredentialById(RealmModel realm, UserModel user, String id)`
    `CredentialModel` | `getStoredCredentialByNameAndType(RealmModel realm, UserModel user, String name, String type)`
    `Stream<CredentialModel>` | `getStoredCredentialsByTypeStream(RealmModel realm, UserModel user, String type)` Obtains the stored credentials associated with the specified user that match the specified type.
    `Stream<CredentialModel>` | `getStoredCredentialsStream(RealmModel realm, UserModel user)` Obtains the stored credentials associated with the specified user.
    `UserModel` | `getUserByEmail(RealmModel realm, String email)` Returns a user with the given email belonging to the realm
    `UserModel` | `getUserByFederatedIdentity(RealmModel realm, FederatedIdentityModel socialLink)` Returns a userModel that corresponds to the given socialLink.
    `UserModel` | `getUserById(RealmModel realm, String id)` Returns a user with the given id belonging to the realm
    `UserModel` | `getUserByUsername(RealmModel realm, String username)` Returns a user with the given username belonging to the realm
    `int` | `getUsersCount(RealmModel realm, boolean includeServiceAccount)` Returns the number of users.
    `Stream<UserModel>` | `getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults)` Searches all users in the realm, starting from the `firstResult` and containing at most `maxResults`.
    `Stream<UserModel>` | `getUsersStream(RealmModel realm, Integer firstResult, Integer maxResults, boolean includeServiceAccounts)` Obtains the users associated with the specified realm.
    `void` | `grantToAllUsers(RealmModel realm, RoleModel role)` Grants the given role to all users from particular realm.
    `boolean` | `moveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId)`
    `void` | `preRemove(ClientScopeModel clientScope)` Called when a client scope is removed.
    `void` | `preRemove(ProtocolMapperModel protocolMapper)` Called when a protocolMapper is removed
    `void` | `preRemove(RealmModel realm)` Called when a realm is removed.
    `void` | `preRemove(RealmModel realm, ClientModel client)` Called when a client is removed.
    `void` | `preRemove(RealmModel realm, ComponentModel component)` Called when a component 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.
    `boolean` | `removeFederatedIdentity(RealmModel realm, UserModel user, String socialProvider)` Removes federation link between the user and the identity provider given by its id
    `void` | `removeImportedUsers(RealmModel realm, String storageProviderId)` Removes any imported users from a specific User Storage Provider.
    `boolean` | `removeStoredCredential(RealmModel realm, UserModel user, String id)`
    `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 id
    `Stream<UserModel>` | `searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue)` Searches for users that have a specific attribute with a specific value.
    `Stream<UserModel>` | `searchForUserStream(RealmModel realm, Map<String,String> attributes, Integer firstResult, Integer maxResults)` Searches for user by parameter.
    `Stream<UserModel>` | `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 in `search` separated by whitespace.
    `void` | `setNotBeforeForUser(RealmModel realm, UserModel user, int notBefore)` Sets the notBefore value for the given user
    `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)` Update client scopes in the stored user consent
    `void` | `updateCredential(RealmModel realm, UserModel user, CredentialModel cred)`
    `void` | `updateFederatedIdentity(RealmModel realm, UserModel federatedUser, FederatedIdentityModel federatedIdentityModel)` Update details of association between the federatedUser and the idp given by the federatedIdentityModel

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.keycloak.models.UserProvider.Streams

      `getConsents, getFederatedIdentities, getFederatedIdentity, getUserByFederatedIdentity, getUsers, getUsers, getUsersStream`

    - ### Methods inherited from interface org.keycloak.storage.user.UserQueryProvider.Streams

      `getGroupMembers, getGroupMembers, getGroupMembersStream, getUsers, getUsers, getUsersCount, getUsersCount, getUsersCount, getUsersCount, getUsersCount, getUsersCount, getUsersCount, getUsersCount, getUsersStream, searchForUser, searchForUser, searchForUser, searchForUser, searchForUserByUserAttribute, searchForUserStream, searchForUserStream`

    - ### Methods inherited from interface org.keycloak.storage.user.UserQueryProvider

      `countUsersInGroups, getRoleMembers, getRoleMembers, getRoleMembersStream, getUsersCount, getUsersCount`

    - ### Methods inherited from interface org.keycloak.storage.user.UserLookupProvider.Streams

      `getUserByEmail, getUserById, getUserByUsername`

    - ### Methods inherited from interface org.keycloak.credential.UserCredentialStore.Streams

      `getStoredCredentials, getStoredCredentialsByType`

- - ### Constructor Detail

    - #### MapUserProvider

          public MapUserProvider(KeycloakSession session,
                                 MapStorage<MapUserEntity,UserModel> store)

  - ### Method Detail

    - #### 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 interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `user` - the user model
        `socialLink` - the federated identity model containing all details of the association between the user and the identity provider

    - #### removeFederatedIdentity

          public boolean removeFederatedIdentity(RealmModel realm,
                                                 UserModel user,
                                                 String socialProvider)

      Description copied from interface: `UserProvider`
      Removes federation link between the user and the identity provider given by its id
      Specified by:
        `removeFederatedIdentity` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `user` - the user model
        `socialProvider` - alias of the identity provider, see `IdentityProviderModel.getAlias()`
      Returns:
        `true` if the association was removed, `false` otherwise

    - #### preRemove

          public void preRemove(RealmModel realm,
                                IdentityProviderModel provider)

      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 interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `provider` - provider model

    - #### 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 interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `federatedUser` - the user model
        `federatedIdentityModel` - the federated identity model containing all details of the association between the user and the identity provider

    - #### 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 interface `UserProvider`
      Specified by:
        `getFederatedIdentitiesStream` in interface `UserProvider.Streams`
      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 interface `UserProvider`
      Specified by:
        `getFederatedIdentity` in interface `UserProvider.Streams`
      Parameters:
        `realm` - a reference to the realm
        `user` - the user model
        `socialProvider` - the id of the identity provider
      Returns:
        federatedIdentityModel or `null` if no association exists

    - #### getUserByFederatedIdentity

          public UserModel getUserByFederatedIdentity(RealmModel realm,
                                                      FederatedIdentityModel socialLink)

      Description copied from interface: `UserProvider`
      Returns a userModel that corresponds to the given socialLink.
      Specified by:
        `getUserByFederatedIdentity` in interface `UserProvider`
      Specified by:
        `getUserByFederatedIdentity` in interface `UserProvider.Streams`
      Parameters:
        `realm` - a reference to the realm
        `socialLink` - the socialLink
      Returns:
        the user corresponding to socialLink and `null` if no such user exists

    - #### addConsent

          public void addConsent(RealmModel realm,
                                 String userId,
                                 UserConsentModel consent)

      Description copied from interface: `UserProvider`
      Add user consent for the user.
      Specified by:
        `addConsent` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `userId` - id of the user
        `consent` - all details corresponding to the granted consent

    - #### getConsentByClient

          public UserConsentModel getConsentByClient(RealmModel realm,
                                                     String userId,
                                                     String clientInternalId)

      Description copied from interface: `UserProvider`
      Returns UserConsentModel given by a user with the userId for the client with clientInternalId
      Specified by:
        `getConsentByClient` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `userId` - id of the user
        `clientInternalId` - id of the client
      Returns:
        consent given by the user to the client or `null` if no consent or user exists

    - #### getConsentsStream

          public Stream<UserConsentModel> getConsentsStream(RealmModel realm,
                                                            String userId)

      Description copied from interface: `UserProvider`
      Obtains the consents associated with the user identified by the specified `userId`.
      Specified by:
        `getConsentsStream` in interface `UserProvider`
      Specified by:
        `getConsentsStream` in interface `UserProvider.Streams`
      Parameters:
        `realm` - a reference to the realm.
        `userId` - the user identifier.
      Returns:
        a non-null `Stream` of consents associated with the user.

    - #### updateConsent

          public void updateConsent(RealmModel realm,
                                    String userId,
                                    UserConsentModel consent)

      Description copied from interface: `UserProvider`
      Update client scopes in the stored user consent
      Specified by:
        `updateConsent` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `userId` - id of the user
        `consent` - new details of the user consent

    - #### revokeConsentForClient

          public boolean revokeConsentForClient(RealmModel realm,
                                                String userId,
                                                String clientInternalId)

      Description copied from interface: `UserProvider`
      Remove a user consent given by the user id and client id
      Specified by:
        `revokeConsentForClient` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `userId` - id of the user
        `clientInternalId` - id of the client
      Returns:
        `true` if the consent was removed, `false` otherwise

    - #### setNotBeforeForUser

          public void setNotBeforeForUser(RealmModel realm,
                                          UserModel user,
                                          int notBefore)

      Description copied from interface: `UserProvider`
      Sets the notBefore value for the given user
      Specified by:
        `setNotBeforeForUser` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `user` - the user model
        `notBefore` - new value for notBefore

    - #### getNotBeforeOfUser

          public int getNotBeforeOfUser(RealmModel realm,
                                        UserModel user)

      Description copied from interface: `UserProvider`
      Gets the notBefore value for the given user
      Specified by:
        `getNotBeforeOfUser` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `user` - the user model
      Returns:
        the value of notBefore

    - #### getServiceAccount

          public UserModel getServiceAccount(ClientModel client)

      Description copied from interface: `UserProvider`
      Return a UserModel representing service account of the client
      Specified by:
        `getServiceAccount` in interface `UserProvider`
      Parameters:
        `client` - the client model
      Returns:
        userModel representing service account of the client

    - #### 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 interface `UserProvider`
      Parameters:
        `realm` - the realm that user will be created in
        `id` - id of the new user. Should be generated to a random value if `null`.
        `username` - username
        `addDefaultRoles` - if `true`, the user should join all realm default roles
        `addDefaultRequiredActions` - if `true`, all default required actions are added to the created user
      Returns:
        model of created user

    - #### preRemove

          public void preRemove(RealmModel realm)

      Description copied from interface: `UserProvider`
      Called when a realm is removed. Should remove all users that belong to the realm.
      Specified by:
        `preRemove` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm

    - #### removeImportedUsers

          public void removeImportedUsers(RealmModel realm,
                                          String storageProviderId)

      Description copied from interface: `UserProvider`
      Removes any imported users from a specific User Storage Provider.
      Specified by:
        `removeImportedUsers` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `storageProviderId` - id of the user storage provider

    - #### unlinkUsers

          public void unlinkUsers(RealmModel realm,
                                  String storageProviderId)

      Description copied from interface: `UserProvider`
      Set federation link to `null` to imported users of a specific User Storage Provider
      Specified by:
        `unlinkUsers` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `storageProviderId` - id of the storage provider

    - #### preRemove

          public void preRemove(RealmModel realm,
                                RoleModel role)

      Description copied from interface: `UserProvider`
      Called when a role is removed. Should remove the role membership for each user.
      Specified by:
        `preRemove` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `role` - the role model

    - #### preRemove

          public void preRemove(RealmModel realm,
                                GroupModel group)

      Description copied from interface: `UserProvider`
      Called when a group is removed. Should remove the group membership for each user.
      Specified by:
        `preRemove` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `group` - the group model

    - #### preRemove

          public void preRemove(RealmModel realm,
                                ClientModel client)

      Description copied from interface: `UserProvider`
      Called when a client is removed. Should remove all user consents associated with the client
      Specified by:
        `preRemove` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `client` - the client model

    - #### preRemove

          public void preRemove(ProtocolMapperModel protocolMapper)

      Description copied from interface: `UserProvider`
      Called when a protocolMapper is removed
      Specified by:
        `preRemove` in interface `UserProvider`
      Parameters:
        `protocolMapper` - the protocolMapper model

    - #### preRemove

          public void preRemove(ClientScopeModel clientScope)

      Description copied from interface: `UserProvider`
      Called when a client scope is removed. Should remove the clientScope from each user consent
      Specified by:
        `preRemove` in interface `UserProvider`
      Parameters:
        `clientScope` - the clientScope model

    - #### preRemove

          public void preRemove(RealmModel realm,
                                ComponentModel component)

      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 interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm
        `component` - the component model

    - #### grantToAllUsers

          public void grantToAllUsers(RealmModel realm,
                                      RoleModel role)

      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 interface `UserBulkUpdateProvider`
      Parameters:
        `realm` - Realm
        `role` - Role to be granted

    - #### getUserById

          public UserModel getUserById(RealmModel realm,
                                       String id)

      Description copied from interface: `UserLookupProvider`
      Returns a user with the given id belonging to the realm
      Specified by:
        `getUserById` in interface `UserLookupProvider`
      Specified by:
        `getUserById` in interface `UserLookupProvider.Streams`
      Parameters:
        `realm` - the realm model
        `id` - id of the user
      Returns:
        found user model, or `null` if no such user exists

    - #### getUserByUsername

          public UserModel getUserByUsername(RealmModel realm,
                                             String username)

      Description copied from interface: `UserLookupProvider`
      Returns a user with the given username belonging to the realm
      Specified by:
        `getUserByUsername` in interface `UserLookupProvider`
      Specified by:
        `getUserByUsername` in interface `UserLookupProvider.Streams`
      Parameters:
        `realm` - the realm model
        `username` - case insensitive username (case-sensitivity is controlled by storage)
      Returns:
        found user model, or `null` if no such user exists

    - #### getUserByEmail

          public UserModel getUserByEmail(RealmModel realm,
                                          String email)

      Description copied from interface: `UserLookupProvider`
      Returns a user with the given email belonging to the realm
      Specified by:
        `getUserByEmail` in interface `UserLookupProvider`
      Specified by:
        `getUserByEmail` in interface `UserLookupProvider.Streams`
      Parameters:
        `realm` - the realm model
        `email` - case insensitive email address (case-sensitivity is controlled by storage)
      Returns:
        found user model, or `null` if no such user exists

    - #### getUsersCount

          public int getUsersCount(RealmModel realm,
                                   boolean includeServiceAccount)

      Description copied from interface: `UserQueryProvider`
      Returns the number of users.
      Specified by:
        `getUsersCount` in interface `UserQueryProvider`
      Parameters:
        `realm` - the realm
        `includeServiceAccount` - if true, the number of users will also include service accounts. Otherwise, only the number of users.
      Returns:
        the number of users

    - #### getUsersStream

          public Stream<UserModel> getUsersStream(RealmModel realm,
                                                  Integer firstResult,
                                                  Integer maxResults,
                                                  boolean includeServiceAccounts)

      Description copied from interface: `UserProvider`
      Obtains the users associated with the specified realm.
      Specified by:
        `getUsersStream` in interface `UserProvider`
      Specified by:
        `getUsersStream` in interface `UserProvider.Streams`
      Parameters:
        `realm` - a reference to the realm being used for the search.
        `firstResult` - first result to return. Ignored if negative, zero, or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
        `includeServiceAccounts` - `true` if service accounts should be included in the result; `false` otherwise.
      Returns:
        a non-null `Stream` of users associated withe the realm.

    - #### getUsersStream

          public Stream<UserModel> getUsersStream(RealmModel realm,
                                                  Integer firstResult,
                                                  Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      Searches all users in the realm, starting from the `firstResult` and containing at most `maxResults`.
      Specified by:
        `getUsersStream` in interface `UserQueryProvider`
      Specified by:
        `getUsersStream` in interface `UserQueryProvider.Streams`
      Parameters:
        `realm` - a reference to the realm.
        `firstResult` - first result to return. Ignored if negative or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users.

    - #### searchForUserStream

          public Stream<UserModel> searchForUserStream(RealmModel realm,
                                                       String search,
                                                       Integer firstResult,
                                                       Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      Searches for users whose username, email, first name or last name contain any of the strings in `search` 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 interface `UserQueryProvider`
      Specified by:
        `searchForUserStream` in interface `UserQueryProvider.Streams`
      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, or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users that match the search criteria.

    - #### searchForUserStream

          public Stream<UserModel> searchForUserStream(RealmModel realm,
                                                       Map<String,String> attributes,
                                                       Integer firstResult,
                                                       Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      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.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.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)
      This method is used by the REST API when querying users.
      Specified by:
        `searchForUserStream` in interface `UserQueryProvider`
      Specified by:
        `searchForUserStream` in interface `UserQueryProvider.Streams`
      Parameters:
        `realm` - a reference to the realm.
        `attributes` - a map containing the search parameters.
        `firstResult` - first result to return. Ignored if negative, zero, or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users that match the search criteria.

    - #### getGroupMembersStream

          public Stream<UserModel> getGroupMembersStream(RealmModel realm,
                                                         GroupModel group,
                                                         Integer firstResult,
                                                         Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      Obtains users that belong to a specific group.
      Specified by:
        `getGroupMembersStream` in interface `UserQueryProvider`
      Specified by:
        `getGroupMembersStream` in interface `UserQueryProvider.Streams`
      Parameters:
        `realm` - a reference to the realm.
        `group` - a reference to the group.
        `firstResult` - first result to return. Ignored if negative, zero, or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users that belong to the group.

    - #### searchForUserByUserAttributeStream

          public Stream<UserModel> searchForUserByUserAttributeStream(RealmModel realm,
                                                                      String attrName,
                                                                      String attrValue)

      Description copied from interface: `UserQueryProvider`
      Searches for users that have a specific attribute with a specific value.
      Specified by:
        `searchForUserByUserAttributeStream` in interface `UserQueryProvider`
      Specified by:
        `searchForUserByUserAttributeStream` in interface `UserQueryProvider.Streams`
      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.

    - #### addUser

          public UserModel addUser(RealmModel realm,
                                   String username)

      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 interface `UserRegistrationProvider`
      Parameters:
        `realm` - a reference to the realm
        `username` - a username the created user will be assigned
      Returns:
        a model of created user

    - #### removeUser

          public boolean removeUser(RealmModel realm,
                                    UserModel user)

      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 interface `UserRegistrationProvider`
      Parameters:
        `realm` - a reference to the realm
        `user` - a reference to the user that is removed
      Returns:
        true if the user was removed, false otherwise

    - #### getRoleMembersStream

          public Stream<UserModel> getRoleMembersStream(RealmModel realm,
                                                        RoleModel role,
                                                        Integer firstResult,
                                                        Integer maxResults)

      Description copied from interface: `UserQueryProvider`
      Searches for users that have the specified role.
      Specified by:
        `getRoleMembersStream` in interface `UserQueryProvider`
      Parameters:
        `realm` - a reference to the realm.
        `role` - a reference to the role.
        `firstResult` - first result to return. Ignored if negative or `null`.
        `maxResults` - maximum number of results to return. Ignored if negative or `null`.
      Returns:
        a non-null `Stream` of users that have the specified role.

    - #### updateCredential

          public void updateCredential(RealmModel realm,
                                       UserModel user,
                                       CredentialModel cred)

      Specified by:
        `updateCredential` in interface `UserCredentialStore`

    - #### createCredential

          public CredentialModel createCredential(RealmModel realm,
                                                  UserModel user,
                                                  CredentialModel cred)

      Specified by:
        `createCredential` in interface `UserCredentialStore`

    - #### removeStoredCredential

          public boolean removeStoredCredential(RealmModel realm,
                                                UserModel user,
                                                String id)

      Specified by:
        `removeStoredCredential` in interface `UserCredentialStore`

    - #### getStoredCredentialById

          public CredentialModel getStoredCredentialById(RealmModel realm,
                                                         UserModel user,
                                                         String id)

      Specified by:
        `getStoredCredentialById` in interface `UserCredentialStore`

    - #### getStoredCredentialsStream

          public Stream<CredentialModel> getStoredCredentialsStream(RealmModel realm,
                                                                    UserModel user)

      Description copied from interface: `UserCredentialStore`
      Obtains the stored credentials associated with the specified user.
      Specified by:
        `getStoredCredentialsStream` in interface `UserCredentialStore`
      Specified by:
        `getStoredCredentialsStream` in interface `UserCredentialStore.Streams`
      Parameters:
        `realm` - a reference to the realm.
        `user` - the user whose credentials are being searched.
      Returns:
        a non-null `Stream` of credentials.

    - #### getStoredCredentialsByTypeStream

          public Stream<CredentialModel> getStoredCredentialsByTypeStream(RealmModel realm,
                                                                          UserModel user,
                                                                          String type)

      Description copied from interface: `UserCredentialStore`
      Obtains the stored credentials associated with the specified user that match the specified type.
      Specified by:
        `getStoredCredentialsByTypeStream` in interface `UserCredentialStore`
      Specified by:
        `getStoredCredentialsByTypeStream` in interface `UserCredentialStore.Streams`
      Parameters:
        `realm` - a reference to the realm.
        `user` - the user whose credentials are being searched.
        `type` - the type of credentials being searched.
      Returns:
        a non-null `Stream` of credentials.

    - #### getStoredCredentialByNameAndType

          public CredentialModel getStoredCredentialByNameAndType(RealmModel realm,
                                                                  UserModel user,
                                                                  String name,
                                                                  String type)

      Specified by:
        `getStoredCredentialByNameAndType` in interface `UserCredentialStore`

    - #### moveCredentialTo

          public boolean moveCredentialTo(RealmModel realm,
                                          UserModel user,
                                          String id,
                                          String newPreviousCredentialId)

      Specified by:
        `moveCredentialTo` in interface `UserCredentialStore`

    - #### close

          public void close()

      Specified by:
        `close` in interface `UserProvider`
      Specified by:
        `close` in interface `Provider`

Copyright © 2021 JBoss by Red Hat. All rights reserved.