org.keycloak.models

## Interface UserModel

- All Superinterfaces:
    RoleMapperModel
  All Known Subinterfaces:
    CachedUserModel, CachedUserModel.Streams, UserModel.Streams
  All Known Implementing Classes:
    AbstractUserAdapter, AbstractUserAdapter.Streams, AbstractUserAdapterFederatedStorage, AbstractUserAdapterFederatedStorage.Streams, AbstractUserModel, GroupLDAPStorageMapper.LDAPGroupMappingsUserDelegate, InMemoryUserAdapter, LDAPWritesOnlyUserModelDelegate, MapUserAdapter, MSADLDSUserAccountControlStorageMapper.MSADUserModelDelegate, MSADUserAccountControlStorageMapper.MSADUserModelDelegate, ReadOnlyKerberosUserModelDelegate, ReadonlyLDAPUserModelDelegate, ReadonlySSSDUserModelDelegate, ReadOnlyUserModelDelegate, RoleLDAPStorageMapper.LDAPRoleMappingsUserDelegate, TxAwareLDAPUserModelDelegate, UpdateOnlyChangeUserModelDelegate, UserAdapter, UserAdapter, UserModelDefaultMethods, UserModelDefaultMethods.Streams, UserModelDelegate

      public interface UserModel
      extends RoleMapperModel

  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Interface and Description
    --- | ---
    `static class` | `UserModel.RequiredAction`
    `static class` | `UserModel.SearchableFields`
    `static interface` | `UserModel.Streams` The `UserModel.Streams` interface makes all collection-based methods in `UserModel` default by providing implementations that delegate to the `Stream`-based variants instead of the other way around.
    `static interface` | `UserModel.UserRemovedEvent`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static Comparator<UserModel>` | `COMPARE_BY_USERNAME`
    `static String` | `DISABLED_REASON`
    `static String` | `EMAIL`
    `static String` | `EMAIL_VERIFIED`
    `static String` | `ENABLED`
    `static String` | `EXACT`
    `static String` | `FIRST_NAME`
    `static String` | `GROUPS`
    `static String` | `IDP_ALIAS`
    `static String` | `IDP_USER_ID`
    `static String` | `INCLUDE_SERVICE_ACCOUNT`
    `static String` | `LAST_NAME`
    `static String` | `LOCALE`
    `static String` | `SEARCH`
    `static String` | `USERNAME`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRequiredAction(String action)`
    `default void` | `addRequiredAction(UserModel.RequiredAction action)`
    `List<String>` | `getAttribute(String name)` Deprecated. Use `getAttributeStream` instead.
    `Map<String,List<String>>` | `getAttributes()`
    `default Stream<String>` | `getAttributeStream(String name)` Obtains all values associated with the specified attribute name.
    `Long` | `getCreatedTimestamp()` Get timestamp of user creation.
    `String` | `getEmail()`
    `String` | `getFederationLink()`
    `String` | `getFirstAttribute(String name)`
    `String` | `getFirstName()`
    `Set<GroupModel>` | `getGroups()` Deprecated. Use `getGroupsStream` instead.
    `default Set<GroupModel>` | `getGroups(int first, int max)` Deprecated. Use `getGroupsStream` instead.
    `default Set<GroupModel>` | `getGroups(String search, int first, int max)` Deprecated. Use `getGroupsStream` instead.
    `default long` | `getGroupsCount()`
    `default long` | `getGroupsCountByNameContaining(String search)`
    `default Stream<GroupModel>` | `getGroupsStream()` Obtains the groups associated with the user.
    `default Stream<GroupModel>` | `getGroupsStream(String search, Integer first, Integer max)` Returns a paginated stream of groups within this realm with search in the name
    `String` | `getId()`
    `String` | `getLastName()`
    `Set<String>` | `getRequiredActions()` Deprecated. Use `getRequiredActionsStream` instead.
    `default Stream<String>` | `getRequiredActionsStream()` Obtains the names of required actions associated with the user.
    `String` | `getServiceAccountClientLink()`
    `String` | `getUsername()`
    `boolean` | `isEmailVerified()`
    `boolean` | `isEnabled()`
    `boolean` | `isMemberOf(GroupModel group)`
    `void` | `joinGroup(GroupModel group)`
    `void` | `leaveGroup(GroupModel group)`
    `void` | `removeAttribute(String name)`
    `void` | `removeRequiredAction(String action)`
    `default void` | `removeRequiredAction(UserModel.RequiredAction action)`
    `void` | `setAttribute(String name, List<String> values)`
    `void` | `setCreatedTimestamp(Long timestamp)`
    `void` | `setEmail(String email)` Sets email for this user.
    `void` | `setEmailVerified(boolean verified)`
    `void` | `setEnabled(boolean enabled)`
    `void` | `setFederationLink(String link)`
    `void` | `setFirstName(String firstName)`
    `void` | `setLastName(String lastName)`
    `void` | `setServiceAccountClientLink(String clientInternalId)`
    `void` | `setSingleAttribute(String name, String value)` Set single value of specified attribute.
    `void` | `setUsername(String username)` Sets username for this user.

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

      `deleteRoleMapping, getClientRoleMappings, getClientRoleMappingsStream, getRealmRoleMappings, getRealmRoleMappingsStream, getRoleMappings, getRoleMappingsStream, grantRole, hasRole`

- - ### Field Detail

    - #### USERNAME

          static final String USERNAME

      See Also:
        Constant Field Values

    - #### FIRST_NAME

          static final String FIRST_NAME

      See Also:
        Constant Field Values

    - #### LAST_NAME

          static final String LAST_NAME

      See Also:
        Constant Field Values

    - #### EMAIL

          static final String EMAIL

      See Also:
        Constant Field Values

    - #### EMAIL_VERIFIED

          static final String EMAIL_VERIFIED

      See Also:
        Constant Field Values

    - #### LOCALE

          static final String LOCALE

      See Also:
        Constant Field Values

    - #### ENABLED

          static final String ENABLED

      See Also:
        Constant Field Values

    - #### IDP_ALIAS

          static final String IDP_ALIAS

      See Also:
        Constant Field Values

    - #### IDP_USER_ID

          static final String IDP_USER_ID

      See Also:
        Constant Field Values

    - #### INCLUDE_SERVICE_ACCOUNT

          static final String INCLUDE_SERVICE_ACCOUNT

      See Also:
        Constant Field Values

    - #### GROUPS

          static final String GROUPS

      See Also:
        Constant Field Values

    - #### SEARCH

          static final String SEARCH

      See Also:
        Constant Field Values

    - #### EXACT

          static final String EXACT

      See Also:
        Constant Field Values

    - #### DISABLED_REASON

          static final String DISABLED_REASON

      See Also:
        Constant Field Values

    - #### COMPARE_BY_USERNAME

          static final Comparator<UserModel> COMPARE_BY_USERNAME

  - ### Method Detail

    - #### getId

          String getId()

    - #### getUsername

          String getUsername()

    - #### setUsername

          void setUsername(String username)

      Sets username for this user. No default method here to allow Abstract subclasses where the username is provided in a different manner
      Parameters:
        `username` - username string

    - #### getCreatedTimestamp

          Long getCreatedTimestamp()

      Get timestamp of user creation. May be null for old users created before this feature introduction.

    - #### setCreatedTimestamp

          void setCreatedTimestamp(Long timestamp)

    - #### isEnabled

          boolean isEnabled()

    - #### setEnabled

          void setEnabled(boolean enabled)

    - #### setSingleAttribute

          void setSingleAttribute(String name,
                                  String value)

      Set single value of specified attribute. Remove all other existing values of this attribute
      Parameters:
        `name` -
        `value` -

    - #### setAttribute

          void setAttribute(String name,
                            List<String> values)

    - #### removeAttribute

          void removeAttribute(String name)

    - #### getFirstAttribute

          String getFirstAttribute(String name)

      Parameters:
        `name` -
      Returns:
        null if there is not any value of specified attribute or first value otherwise. Don't throw exception if there are more values of the attribute

    - #### getAttribute

          @Deprecated
          List<String> getAttribute(String name)

      Deprecated. Use `getAttributeStream` instead.
      Parameters:
        `name` -
      Returns:
        list of all attribute values or empty list if there are not any values. Never return null

    - #### getAttributeStream

          default Stream<String> getAttributeStream(String name)

      Obtains all values associated with the specified attribute name.
      Parameters:
        `name` - the name of the attribute.
      Returns:
        a non-null `Stream` of attribute values.

    - #### getAttributes

          Map<String,List<String>> getAttributes()

    - #### getRequiredActions

          @Deprecated
          Set<String> getRequiredActions()

      Deprecated. Use `getRequiredActionsStream` instead.

    - #### getRequiredActionsStream

          default Stream<String> getRequiredActionsStream()

      Obtains the names of required actions associated with the user.
      Returns:
        a non-null `Stream` of required action names.

    - #### addRequiredAction

          void addRequiredAction(String action)

    - #### removeRequiredAction

          void removeRequiredAction(String action)

    - #### addRequiredAction

          default void addRequiredAction(UserModel.RequiredAction action)

    - #### removeRequiredAction

          default void removeRequiredAction(UserModel.RequiredAction action)

    - #### getFirstName

          String getFirstName()

    - #### setFirstName

          void setFirstName(String firstName)

    - #### getLastName

          String getLastName()

    - #### setLastName

          void setLastName(String lastName)

    - #### getEmail

          String getEmail()

    - #### setEmail

          void setEmail(String email)

      Sets email for this user.
      Parameters:
        `email` - the email

    - #### isEmailVerified

          boolean isEmailVerified()

    - #### setEmailVerified

          void setEmailVerified(boolean verified)

    - #### getGroups

          @Deprecated
          Set<GroupModel> getGroups()

      Deprecated. Use `getGroupsStream` instead.

    - #### getGroupsStream

          default Stream<GroupModel> getGroupsStream()

      Obtains the groups associated with the user.
      Returns:
        a non-null `Stream` of groups.

    - #### getGroups

          @Deprecated
          default Set<GroupModel> getGroups(int first,
                                                        int max)

      Deprecated. Use `getGroupsStream` instead.

    - #### getGroups

          @Deprecated
          default Set<GroupModel> getGroups(String search,
                                                        int first,
                                                        int max)

      Deprecated. Use `getGroupsStream` instead.

    - #### getGroupsStream

          default Stream<GroupModel> getGroupsStream(String search,
                                                     Integer first,
                                                     Integer max)

      Returns a paginated stream of groups within this realm with search in the name
      Parameters:
        `search` - Case insensitive string which will be searched for. Ignored if null.
        `first` - Index of first group to return. Ignored if negative or `null`.
        `max` - Maximum number of records to return. Ignored if negative or `null`.
      Returns:
        Stream of desired groups. Never returns `null`.

    - #### getGroupsCount

          default long getGroupsCount()

    - #### getGroupsCountByNameContaining

          default long getGroupsCountByNameContaining(String search)

    - #### joinGroup

          void joinGroup(GroupModel group)

    - #### leaveGroup

          void leaveGroup(GroupModel group)

    - #### isMemberOf

          boolean isMemberOf(GroupModel group)

    - #### getFederationLink

          String getFederationLink()

    - #### setFederationLink

          void setFederationLink(String link)

    - #### getServiceAccountClientLink

          String getServiceAccountClientLink()

    - #### setServiceAccountClientLink

          void setServiceAccountClientLink(String clientInternalId)

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