org.keycloak.storage.adapter

## Class AbstractUserAdapterFederatedStorage

- java.lang.Object
- - org.keycloak.storage.adapter.AbstractUserAdapterFederatedStorage

- All Implemented Interfaces:
    RoleMapperModel, UserModel

      public abstract class AbstractUserAdapterFederatedStorage
      extends Object
      implements UserModel

  Assumes everything is managed by federated storage except for username. getId() returns a default value of "f:" + providerId + ":" + getUsername(). UserModel properties like enabled, firstName, lastName, email, etc. are all stored as attributes in federated storage. isEnabled() defaults to true if the ENABLED_ATTRIBUTE isn't set in federated
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Nested Class Summary

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

      `UserModel.RequiredAction, UserModel.UserRemovedEvent`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `CREATED_TIMESTAMP_ATTRIBUTE`
    `static String` | `EMAIL_ATTRIBUTE`
    `static String` | `EMAIL_VERIFIED_ATTRIBUTE`
    `static String` | `ENABLED_ATTRIBUTE`
    `static String` | `FIRST_NAME_ATTRIBUTE`
    `static String` | `LAST_NAME_ATTRIBUTE`
    `static String` | `OTP_ENABLED_ATTRIBUTE`
    `protected RealmModel` | `realm`
    `protected KeycloakSession` | `session`
    `protected StorageId` | `storageId`
    `protected ComponentModel` | `storageProviderModel`

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

      `EMAIL, FIRST_NAME, LAST_NAME, LOCALE, USERNAME`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRequiredAction(String action)`
    `void` | `addRequiredAction(UserModel.RequiredAction action)`
    `protected boolean` | `appendDefaultGroups()` Should the realm's default groups be appended to getGroups() call? If your storage provider is not managing group mappings then it is recommended that this method return true
    `protected boolean` | `appendDefaultRolesToRoleMappings()` Should the realm's default roles be appended to getRoleMappings() call? If your storage provider is not managing all role mappings then it is recommended that this method return true
    `void` | `deleteRoleMapping(RoleModel role)`
    `boolean` | `equals(Object o)`
    `List<String>` | `getAttribute(String name)`
    `Map<String,List<String>>` | `getAttributes()`
    `Set<RoleModel>` | `getClientRoleMappings(ClientModel app)`
    `Long` | `getCreatedTimestamp()` Get timestamp of user creation.
    `List<UserCredentialValueModel>` | `getCredentialsDirectly()`
    `String` | `getEmail()`
    `protected Set<RoleModel>` | `getFederatedRoleMappings()`
    `UserFederatedStorageProvider` | `getFederatedStorage()`
    `String` | `getFederationLink()` This method should not be overriden
    `String` | `getFirstAttribute(String name)`
    `String` | `getFirstName()`
    `Set<GroupModel>` | `getGroups()`
    `protected Set<GroupModel>` | `getGroupsInternal()` Get group membership mappings that are managed by this storage provider
    `String` | `getId()` Defaults to 'f:' + storageProvider.getId() + ':' + getUsername()
    `String` | `getLastName()`
    `Set<RoleModel>` | `getRealmRoleMappings()`
    `Set<String>` | `getRequiredActions()`
    `Set<RoleModel>` | `getRoleMappings()`
    `protected Set<RoleModel>` | `getRoleMappingsInternal()`
    `String` | `getServiceAccountClientLink()` This method should not be overriden
    `void` | `grantRole(RoleModel role)`
    `int` | `hashCode()`
    `boolean` | `hasRole(RoleModel role)`
    `boolean` | `isEmailVerified()`
    `boolean` | `isEnabled()`
    `boolean` | `isMemberOf(GroupModel group)`
    `boolean` | `isOtpEnabled()`
    `void` | `joinGroup(GroupModel group)`
    `void` | `leaveGroup(GroupModel group)`
    `void` | `removeAttribute(String name)`
    `void` | `removeRequiredAction(String action)`
    `void` | `removeRequiredAction(UserModel.RequiredAction action)`
    `void` | `setAttribute(String name, List<String> values)`
    `void` | `setCreatedTimestamp(Long timestamp)`
    `void` | `setEmail(String email)`
    `void` | `setEmailVerified(boolean verified)`
    `void` | `setEnabled(boolean enabled)`
    `void` | `setFederationLink(String link)` This method should not be overriden
    `void` | `setFirstName(String firstName)`
    `void` | `setLastName(String lastName)`
    `void` | `setOtpEnabled(boolean totp)`
    `void` | `setServiceAccountClientLink(String clientInternalId)` This method should not be overriden
    `void` | `setSingleAttribute(String name, String value)` Set single value of specified attribute.
    `void` | `updateCredential(UserCredentialModel cred)`
    `void` | `updateCredentialDirectly(UserCredentialValueModel cred)`

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

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

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

      `getUsername, setUsername`

- - ### Field Detail

    - #### FIRST_NAME_ATTRIBUTE

          public static String FIRST_NAME_ATTRIBUTE

    - #### LAST_NAME_ATTRIBUTE

          public static String LAST_NAME_ATTRIBUTE

    - #### EMAIL_ATTRIBUTE

          public static String EMAIL_ATTRIBUTE

    - #### EMAIL_VERIFIED_ATTRIBUTE

          public static String EMAIL_VERIFIED_ATTRIBUTE

    - #### CREATED_TIMESTAMP_ATTRIBUTE

          public static String CREATED_TIMESTAMP_ATTRIBUTE

    - #### ENABLED_ATTRIBUTE

          public static String ENABLED_ATTRIBUTE

    - #### OTP_ENABLED_ATTRIBUTE

          public static String OTP_ENABLED_ATTRIBUTE

    - #### session

          protected KeycloakSession session

    - #### realm

          protected RealmModel realm

    - #### storageProviderModel

          protected ComponentModel storageProviderModel

    - #### storageId

          protected StorageId storageId

  - ### Constructor Detail

    - #### AbstractUserAdapterFederatedStorage

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

  - ### Method Detail

    - #### getFederatedStorage

          public UserFederatedStorageProvider getFederatedStorage()

    - #### getRequiredActions

          public Set<String> getRequiredActions()

      Specified by:
        `getRequiredActions` in interface `UserModel`

    - #### addRequiredAction

          public void addRequiredAction(String action)

      Specified by:
        `addRequiredAction` in interface `UserModel`

    - #### removeRequiredAction

          public void removeRequiredAction(String action)

      Specified by:
        `removeRequiredAction` in interface `UserModel`

    - #### addRequiredAction

          public void addRequiredAction(UserModel.RequiredAction action)

      Specified by:
        `addRequiredAction` in interface `UserModel`

    - #### removeRequiredAction

          public void removeRequiredAction(UserModel.RequiredAction action)

      Specified by:
        `removeRequiredAction` in interface `UserModel`

    - #### getGroupsInternal

          protected Set<GroupModel> getGroupsInternal()

      Get group membership mappings that are managed by this storage provider
      Returns:

    - #### appendDefaultGroups

          protected boolean appendDefaultGroups()

      Should the realm's default groups be appended to getGroups() call? If your storage provider is not managing group mappings then it is recommended that this method return true
      Returns:

    - #### getGroups

          public Set<GroupModel> getGroups()

      Specified by:
        `getGroups` in interface `UserModel`

    - #### joinGroup

          public void joinGroup(GroupModel group)

      Specified by:
        `joinGroup` in interface `UserModel`

    - #### leaveGroup

          public void leaveGroup(GroupModel group)

      Specified by:
        `leaveGroup` in interface `UserModel`

    - #### isMemberOf

          public boolean isMemberOf(GroupModel group)

      Specified by:
        `isMemberOf` in interface `UserModel`

    - #### getRealmRoleMappings

          public Set<RoleModel> getRealmRoleMappings()

      Specified by:
        `getRealmRoleMappings` in interface `RoleMapperModel`

    - #### getClientRoleMappings

          public Set<RoleModel> getClientRoleMappings(ClientModel app)

      Specified by:
        `getClientRoleMappings` in interface `RoleMapperModel`

    - #### hasRole

          public boolean hasRole(RoleModel role)

      Specified by:
        `hasRole` in interface `RoleMapperModel`

    - #### grantRole

          public void grantRole(RoleModel role)

      Specified by:
        `grantRole` in interface `RoleMapperModel`

    - #### appendDefaultRolesToRoleMappings

          protected boolean appendDefaultRolesToRoleMappings()

      Should the realm's default roles be appended to getRoleMappings() call? If your storage provider is not managing all role mappings then it is recommended that this method return true
      Returns:

    - #### getRoleMappingsInternal

          protected Set<RoleModel> getRoleMappingsInternal()

    - #### getRoleMappings

          public Set<RoleModel> getRoleMappings()

      Specified by:
        `getRoleMappings` in interface `RoleMapperModel`

    - #### getFederatedRoleMappings

          protected Set<RoleModel> getFederatedRoleMappings()

    - #### deleteRoleMapping

          public void deleteRoleMapping(RoleModel role)

      Specified by:
        `deleteRoleMapping` in interface `RoleMapperModel`

    - #### isEnabled

          public boolean isEnabled()

      Specified by:
        `isEnabled` in interface `UserModel`

    - #### setEnabled

          public void setEnabled(boolean enabled)

      Specified by:
        `setEnabled` in interface `UserModel`

    - #### isOtpEnabled

          public boolean isOtpEnabled()

      Specified by:
        `isOtpEnabled` in interface `UserModel`

    - #### setOtpEnabled

          public void setOtpEnabled(boolean totp)

      Specified by:
        `setOtpEnabled` in interface `UserModel`

    - #### getFederationLink

          public String getFederationLink()

      This method should not be overriden
      Specified by:
        `getFederationLink` in interface `UserModel`
      Returns:

    - #### setFederationLink

          public void setFederationLink(String link)

      This method should not be overriden
      Specified by:
        `setFederationLink` in interface `UserModel`

    - #### getServiceAccountClientLink

          public String getServiceAccountClientLink()

      This method should not be overriden
      Specified by:
        `getServiceAccountClientLink` in interface `UserModel`
      Returns:

    - #### setServiceAccountClientLink

          public void setServiceAccountClientLink(String clientInternalId)

      This method should not be overriden
      Specified by:
        `setServiceAccountClientLink` in interface `UserModel`

    - #### getId

          public String getId()

      Defaults to 'f:' + storageProvider.getId() + ':' + getUsername()
      Specified by:
        `getId` in interface `UserModel`
      Returns:

    - #### getCreatedTimestamp

          public Long getCreatedTimestamp()

      Description copied from interface: `UserModel`
      Get timestamp of user creation. May be null for old users created before this feature introduction.
      Specified by:
        `getCreatedTimestamp` in interface `UserModel`

    - #### setCreatedTimestamp

          public void setCreatedTimestamp(Long timestamp)

      Specified by:
        `setCreatedTimestamp` in interface `UserModel`

    - #### setSingleAttribute

          public void setSingleAttribute(String name,
                                         String value)

      Description copied from interface: `UserModel`
      Set single value of specified attribute. Remove all other existing values
      Specified by:
        `setSingleAttribute` in interface `UserModel`

    - #### removeAttribute

          public void removeAttribute(String name)

      Specified by:
        `removeAttribute` in interface `UserModel`

    - #### setAttribute

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

      Specified by:
        `setAttribute` in interface `UserModel`

    - #### getFirstAttribute

          public String getFirstAttribute(String name)

      Specified by:
        `getFirstAttribute` in interface `UserModel`
      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

    - #### getAttributes

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

      Specified by:
        `getAttributes` in interface `UserModel`

    - #### getAttribute

          public List<String> getAttribute(String name)

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

    - #### getFirstName

          public String getFirstName()

      Specified by:
        `getFirstName` in interface `UserModel`

    - #### setFirstName

          public void setFirstName(String firstName)

      Specified by:
        `setFirstName` in interface `UserModel`

    - #### getLastName

          public String getLastName()

      Specified by:
        `getLastName` in interface `UserModel`

    - #### setLastName

          public void setLastName(String lastName)

      Specified by:
        `setLastName` in interface `UserModel`

    - #### getEmail

          public String getEmail()

      Specified by:
        `getEmail` in interface `UserModel`

    - #### setEmail

          public void setEmail(String email)

      Specified by:
        `setEmail` in interface `UserModel`

    - #### isEmailVerified

          public boolean isEmailVerified()

      Specified by:
        `isEmailVerified` in interface `UserModel`

    - #### setEmailVerified

          public void setEmailVerified(boolean verified)

      Specified by:
        `setEmailVerified` in interface `UserModel`

    - #### updateCredential

          public void updateCredential(UserCredentialModel cred)

      Specified by:
        `updateCredential` in interface `UserModel`

    - #### getCredentialsDirectly

          public List<UserCredentialValueModel> getCredentialsDirectly()

      Specified by:
        `getCredentialsDirectly` in interface `UserModel`

    - #### updateCredentialDirectly

          public void updateCredentialDirectly(UserCredentialValueModel cred)

      Specified by:
        `updateCredentialDirectly` in interface `UserModel`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

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