org.keycloak.models

## Interface UserProvider.Streams

- All Superinterfaces:
    Provider, UserBulkUpdateProvider, UserLookupProvider, UserLookupProvider.Streams, UserProvider, UserQueryProvider, UserQueryProvider.Streams, UserRegistrationProvider
  All Known Subinterfaces:
    UserCache.Streams
  All Known Implementing Classes:
    JpaUserProvider, MapUserProvider, UserCacheSession, UserStorageManager
  Enclosing interface:
    UserProvider

      public static interface UserProvider.Streams
      extends UserProvider, UserQueryProvider.Streams, UserLookupProvider.Streams

  The `UserProvider.Streams` interface makes all collection-based methods in `UserProvider` default by providing implementations that delegate to the `Stream`-based variants instead of the other way around.

  It allows for implementations to focus on the `Stream`-based approach for processing sets of data and benefit from the potential memory and performance optimizations of that approach.

- - ### Nested Class Summary

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

      `UserProvider.Streams`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods
    Modifier and Type | Method and Description
    --- | ---
    `default List<UserConsentModel>` | `getConsents(RealmModel realm, String userId)`
    `Stream<UserConsentModel>` | `getConsentsStream(RealmModel realm, String userId)` Obtains the consents associated with the user identified by the specified `userId`.
    `default Set<FederatedIdentityModel>` | `getFederatedIdentities(UserModel user, RealmModel realm)`
    `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.
    `default FederatedIdentityModel` | `getFederatedIdentity(UserModel user, String socialProvider, RealmModel realm)`
    `default UserModel` | `getUserByFederatedIdentity(FederatedIdentityModel socialLink, RealmModel realm)`
    `UserModel` | `getUserByFederatedIdentity(RealmModel realm, FederatedIdentityModel socialLink)` Returns a userModel that corresponds to the given socialLink.
    `default List<UserModel>` | `getUsers(RealmModel realm, boolean includeServiceAccounts)`
    `default List<UserModel>` | `getUsers(RealmModel realm, int firstResult, int maxResults, boolean includeServiceAccounts)`
    `default 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.

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

      `addConsent, addFederatedIdentity, addUser, close, getConsentByClient, getNotBeforeOfUser, getServiceAccount, preRemove, preRemove, preRemove, preRemove, preRemove, preRemove, preRemove, preRemove, removeFederatedIdentity, removeImportedUsers, revokeConsentForClient, setNotBeforeForUser, unlinkUsers, updateConsent, updateFederatedIdentity`

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

      `addUser, removeUser`

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

      `grantToAllUsers`

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

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

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

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

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

      `getUserByEmail, getUserByEmail, getUserById, getUserById, getUserByUsername, getUserByUsername`

- - ### Method Detail

    - #### getFederatedIdentity

          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`
      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

    - #### getFederatedIdentity

          default FederatedIdentityModel getFederatedIdentity(UserModel user,
                                                              String socialProvider,
                                                              RealmModel realm)

      Specified by:
        `getFederatedIdentity` in interface `UserProvider`

    - #### getUserByFederatedIdentity

          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`
      Parameters:
        `realm` - a reference to the realm
        `socialLink` - the socialLink
      Returns:
        the user corresponding to socialLink and `null` if no such user exists

    - #### getUserByFederatedIdentity

          default UserModel getUserByFederatedIdentity(FederatedIdentityModel socialLink,
                                                       RealmModel realm)

      Specified by:
        `getUserByFederatedIdentity` in interface `UserProvider`

    - #### getFederatedIdentities

          default Set<FederatedIdentityModel> getFederatedIdentities(UserModel user,
                                                                     RealmModel realm)

      Specified by:
        `getFederatedIdentities` in interface `UserProvider`

    - #### getFederatedIdentitiesStream

          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`
      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.

    - #### getConsents

          default List<UserConsentModel> getConsents(RealmModel realm,
                                                     String userId)

      Specified by:
        `getConsents` in interface `UserProvider`

    - #### getConsentsStream

          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`
      Parameters:
        `realm` - a reference to the realm.
        `userId` - the user identifier.
      Returns:
        a non-null `Stream` of consents associated with the user.

    - #### getUsers

          default List<UserModel> getUsers(RealmModel realm,
                                           boolean includeServiceAccounts)

      Specified by:
        `getUsers` in interface `UserProvider`

    - #### getUsersStream

          default Stream<UserModel> getUsersStream(RealmModel realm,
                                                   boolean includeServiceAccounts)

      Description copied from interface: `UserProvider`
      Obtains the users associated with the specified realm.
      Specified by:
        `getUsersStream` in interface `UserProvider`
      Parameters:
        `realm` - a reference to the realm being used for the search.
        `includeServiceAccounts` - `true` if service accounts should be included in the result; `false` otherwise.
      Returns:
        a non-null `Stream` of users associated withe the realm.

    - #### getUsers

          default List<UserModel> getUsers(RealmModel realm,
                                           int firstResult,
                                           int maxResults,
                                           boolean includeServiceAccounts)

      Specified by:
        `getUsers` in interface `UserProvider`

    - #### getUsersStream

          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`
      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.

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