org.keycloak.storage.adapter

## Class AbstractUserAdapter.Streams

- java.lang.Object
- - org.keycloak.models.UserModelDefaultMethods
  - - org.keycloak.storage.adapter.AbstractUserAdapter
    - - org.keycloak.storage.adapter.AbstractUserAdapter.Streams

- All Implemented Interfaces:
    RoleMapperModel, RoleMapperModel.Streams, UserModel, UserModel.Streams
  Enclosing class:
    AbstractUserAdapter

      public abstract static class AbstractUserAdapter.Streams
      extends AbstractUserAdapter
      implements UserModel.Streams

  The `AbstractUserAdapter.Streams` class extends the `AbstractUserAdapter` abstract class and implements the `UserModel.Streams` interface, allowing subclasses to focus on the implementation of the `Stream`-based query methods and providing default implementations for the collections-based variants that delegate to their `Stream` counterparts.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.keycloak.storage.adapter.AbstractUserAdapter

      `AbstractUserAdapter.Streams`

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

      `UserModel.RequiredAction, UserModel.Streams, UserModel.UserRemovedEvent`

  - ### Field Summary

    - ### Fields inherited from class org.keycloak.storage.adapter.AbstractUserAdapter

      `created, realm, session, storageId, storageProviderModel`

    - ### Fields inherited from interface org.keycloak.models.UserModel

      `COMPARE_BY_USERNAME, EMAIL, EMAIL_VERIFIED, ENABLED, EXACT, FIRST_NAME, GROUPS, IDP_ALIAS, IDP_USER_ID, INCLUDE_SERVICE_ACCOUNT, LAST_NAME, LOCALE, SEARCH, USERNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Streams(KeycloakSession session, RealmModel realm, ComponentModel storageProviderModel)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `List<String>` | `getAttribute(String name)`
    `Stream<String>` | `getAttributeStream(String name)` Obtains all values associated with the specified attribute name.
    `Set<RoleModel>` | `getClientRoleMappings(ClientModel app)` Returns set of client roles that are directly set to this object for the given client.
    `Stream<RoleModel>` | `getClientRoleMappingsStream(ClientModel app)` Returns stream of client roles that are directly set to this object for the given client.
    `Set<GroupModel>` | `getGroups()`
    `Stream<GroupModel>` | `getGroupsStream()` Obtains the groups associated with the user.
    `Set<RoleModel>` | `getRealmRoleMappings()` Returns set of realm roles that are directly set to this object.
    `Stream<RoleModel>` | `getRealmRoleMappingsStream()` Returns stream of realm roles that are directly set to this object.
    `Set<String>` | `getRequiredActions()`
    `Stream<String>` | `getRequiredActionsStream()` Obtains the names of required actions associated with the user.
    `Set<RoleModel>` | `getRoleMappings()` Returns set of all role (both realm all client) that are directly set to this object.
    `Stream<RoleModel>` | `getRoleMappingsStream()` Returns stream of all role (both realm all client) that are directly set to this object.
    `boolean` | `hasRole(RoleModel role)` Returns `true` if this object is directly or indirectly assigned the given role, `false` otherwise.
    `boolean` | `isMemberOf(GroupModel group)`

    - ### Methods inherited from class org.keycloak.storage.adapter.AbstractUserAdapter

      `addRequiredAction, addRequiredAction, appendDefaultGroups, appendDefaultRolesToRoleMappings, deleteRoleMapping, equals, getAttributes, getCreatedTimestamp, getEmail, getFederationLink, getFirstAttribute, getFirstName, getGroupsInternal, getId, getLastName, getRoleMappingsInternal, getServiceAccountClientLink, grantRole, hashCode, isEmailVerified, isEnabled, joinGroup, leaveGroup, removeAttribute, removeRequiredAction, removeRequiredAction, setAttribute, setCreatedTimestamp, setEmail, setEmailVerified, setEnabled, setFederationLink, setFirstName, setLastName, setServiceAccountClientLink, setSingleAttribute, setUsername`

    - ### Methods inherited from class org.keycloak.models.UserModelDefaultMethods

      `toString`

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

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

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

      `addRequiredAction, addRequiredAction, getAttributes, getCreatedTimestamp, getEmail, getFederationLink, getFirstAttribute, getFirstName, getGroups, getGroups, getGroupsCount, getGroupsCountByNameContaining, getGroupsStream, getId, getLastName, getServiceAccountClientLink, getUsername, isEmailVerified, isEnabled, joinGroup, leaveGroup, removeAttribute, removeRequiredAction, removeRequiredAction, setAttribute, setCreatedTimestamp, setEmail, setEmailVerified, setEnabled, setFederationLink, setFirstName, setLastName, setServiceAccountClientLink, setSingleAttribute, setUsername`

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

      `deleteRoleMapping, grantRole`

- - ### Constructor Detail

    - #### Streams

          public Streams(KeycloakSession session,
                         RealmModel realm,
                         ComponentModel storageProviderModel)

  - ### Method Detail

    - #### getRequiredActions

          public Set<String> getRequiredActions()

      Specified by:
        `getRequiredActions` in interface `UserModel`
      Specified by:
        `getRequiredActions` in interface `UserModel.Streams`
      Overrides:
        `getRequiredActions` in class `AbstractUserAdapter`

    - #### getRequiredActionsStream

          public Stream<String> getRequiredActionsStream()

      Description copied from interface: `UserModel`
      Obtains the names of required actions associated with the user.
      Specified by:
        `getRequiredActionsStream` in interface `UserModel`
      Specified by:
        `getRequiredActionsStream` in interface `UserModel.Streams`
      Returns:
        a non-null `Stream` of required action names.

    - #### getAttribute

          public List<String> getAttribute(String name)

      Specified by:
        `getAttribute` in interface `UserModel`
      Specified by:
        `getAttribute` in interface `UserModel.Streams`
      Overrides:
        `getAttribute` in class `AbstractUserAdapter`
      Returns:
        list of all attribute values or empty list if there are not any values. Never return null

    - #### getAttributeStream

          public Stream<String> getAttributeStream(String name)

      Description copied from interface: `UserModel`
      Obtains all values associated with the specified attribute name.
      Specified by:
        `getAttributeStream` in interface `UserModel`
      Specified by:
        `getAttributeStream` in interface `UserModel.Streams`
      Parameters:
        `name` - the name of the attribute.
      Returns:
        a non-null `Stream` of attribute values.

    - #### getGroups

          public Set<GroupModel> getGroups()

      Specified by:
        `getGroups` in interface `UserModel`
      Specified by:
        `getGroups` in interface `UserModel.Streams`
      Overrides:
        `getGroups` in class `AbstractUserAdapter`

    - #### getGroupsStream

          public Stream<GroupModel> getGroupsStream()

      Description copied from interface: `UserModel`
      Obtains the groups associated with the user.
      Specified by:
        `getGroupsStream` in interface `UserModel`
      Specified by:
        `getGroupsStream` in interface `UserModel.Streams`
      Returns:
        a non-null `Stream` of groups.

    - #### isMemberOf

          public boolean isMemberOf(GroupModel group)

      Specified by:
        `isMemberOf` in interface `UserModel`
      Overrides:
        `isMemberOf` in class `AbstractUserAdapter`

    - #### getRealmRoleMappings

          public Set<RoleModel> getRealmRoleMappings()

      Description copied from interface: `RoleMapperModel`
      Returns set of realm roles that are directly set to this object.
      Specified by:
        `getRealmRoleMappings` in interface `RoleMapperModel`
      Specified by:
        `getRealmRoleMappings` in interface `RoleMapperModel.Streams`
      Overrides:
        `getRealmRoleMappings` in class `AbstractUserAdapter`
      Returns:
        see description

    - #### getRealmRoleMappingsStream

          public Stream<RoleModel> getRealmRoleMappingsStream()

      Description copied from interface: `RoleMapperModel`
      Returns stream of realm roles that are directly set to this object.
      Specified by:
        `getRealmRoleMappingsStream` in interface `RoleMapperModel`
      Specified by:
        `getRealmRoleMappingsStream` in interface `RoleMapperModel.Streams`
      Returns:
        stream of `RoleModel`

    - #### getClientRoleMappings

          public Set<RoleModel> getClientRoleMappings(ClientModel app)

      Description copied from interface: `RoleMapperModel`
      Returns set of client roles that are directly set to this object for the given client.
      Specified by:
        `getClientRoleMappings` in interface `RoleMapperModel`
      Specified by:
        `getClientRoleMappings` in interface `RoleMapperModel.Streams`
      Overrides:
        `getClientRoleMappings` in class `AbstractUserAdapter`
      Parameters:
        `app` - Client to get the roles for
      Returns:
        see description

    - #### getClientRoleMappingsStream

          public Stream<RoleModel> getClientRoleMappingsStream(ClientModel app)

      Description copied from interface: `RoleMapperModel`
      Returns stream of client roles that are directly set to this object for the given client.
      Specified by:
        `getClientRoleMappingsStream` in interface `RoleMapperModel`
      Specified by:
        `getClientRoleMappingsStream` in interface `RoleMapperModel.Streams`
      Parameters:
        `app` - Client to get the roles for
      Returns:
        stream of `RoleModel`

    - #### getRoleMappings

          public Set<RoleModel> getRoleMappings()

      Description copied from interface: `RoleMapperModel`
      Returns set of all role (both realm all client) that are directly set to this object.
      Specified by:
        `getRoleMappings` in interface `RoleMapperModel`
      Specified by:
        `getRoleMappings` in interface `RoleMapperModel.Streams`
      Overrides:
        `getRoleMappings` in class `AbstractUserAdapter`
      Returns:

    - #### getRoleMappingsStream

          public Stream<RoleModel> getRoleMappingsStream()

      Description copied from interface: `RoleMapperModel`
      Returns stream of all role (both realm all client) that are directly set to this object.
      Specified by:
        `getRoleMappingsStream` in interface `RoleMapperModel`
      Specified by:
        `getRoleMappingsStream` in interface `RoleMapperModel.Streams`
      Returns:
        stream of `RoleModel`

    - #### hasRole

          public boolean hasRole(RoleModel role)

      Description copied from interface: `RoleMapperModel`
      Returns `true` if this object is directly or indirectly assigned the given role, `false` otherwise.

      For example, `true` is returned for hasRole(R) if:

      - R is directly assigned to this object
      - R is not assigned to this object but this object belongs to a group G which is assigned the role R
      - R is not assigned to this object but this object belongs to a group G, and G belongs to group H which is assigned the role R
      Specified by:
        `hasRole` in interface `RoleMapperModel`
      Overrides:
        `hasRole` in class `AbstractUserAdapter`
      Returns:
        see description

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