org.keycloak.models.mongo.keycloak.adapters

## Class UserAdapter

- java.lang.Object
- - org.keycloak.models.mongo.keycloak.adapters.AbstractMongoAdapter<MongoUserEntity>
  - - org.keycloak.models.mongo.keycloak.adapters.UserAdapter

- All Implemented Interfaces:
    UserModel

      public class UserAdapter
      extends AbstractMongoAdapter<MongoUserEntity>
      implements UserModel

  Wrapper around UserData object, which will persist wrapped object after each set operation (compatibility with picketlink based idm)
  Author:
    Marek Posolda

- - ### Nested Class Summary

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

      `UserModel.RequiredAction`

  - ### Field Summary

    - ### Fields inherited from class org.keycloak.models.mongo.keycloak.adapters.AbstractMongoAdapter

      `invocationContext`

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

      `EMAIL, FIRST_NAME, LAST_NAME, USERNAME`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `UserAdapter(KeycloakSession session, RealmModel realm, MongoUserEntity userEntity, MongoStoreInvocationContext invContext)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addRequiredAction(UserModel.RequiredAction action)`
    `void` | `deleteRoleMapping(RoleModel role)`
    `boolean` | `equals(Object o)`
    `Set<RoleModel>` | `getApplicationRoleMappings(ApplicationModel app)`
    `String` | `getAttribute(String name)`
    `Map<String,String>` | `getAttributes()`
    `List<UserCredentialValueModel>` | `getCredentialsDirectly()`
    `String` | `getEmail()`
    `String` | `getFederationLink()`
    `String` | `getFirstName()`
    `String` | `getId()`
    `String` | `getLastName()`
    `MongoUserEntity` | `getMongoEntity()`
    `Set<RoleModel>` | `getRealmRoleMappings()`
    `Set<UserModel.RequiredAction>` | `getRequiredActions()`
    `Set<RoleModel>` | `getRoleMappings()`
    `MongoUserEntity` | `getUser()`
    `String` | `getUsername()`
    `void` | `grantRole(RoleModel role)`
    `int` | `hashCode()`
    `boolean` | `hasRole(RoleModel role)`
    `boolean` | `isEmailVerified()`
    `boolean` | `isEnabled()`
    `boolean` | `isTotp()`
    `void` | `removeAttribute(String name)`
    `void` | `removeRequiredAction(UserModel.RequiredAction action)`
    `void` | `setAttribute(String name, String value)`
    `void` | `setEmail(String email)`
    `void` | `setEmailVerified(boolean verified)`
    `void` | `setEnabled(boolean enabled)`
    `void` | `setFederationLink(String link)`
    `void` | `setFirstName(String firstName)`
    `void` | `setLastName(String lastName)`
    `void` | `setTotp(boolean totp)`
    `void` | `setUsername(String username)`
    `void` | `updateCredential(UserCredentialModel cred)`
    `void` | `updateCredentialDirectly(UserCredentialValueModel credModel)`
    `protected void` | `updateUser()`

    - ### Methods inherited from class org.keycloak.models.mongo.keycloak.adapters.AbstractMongoAdapter

      `getMongoStore, updateMongoEntity`

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

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

- - ### Constructor Detail

    - #### UserAdapter

          public UserAdapter(KeycloakSession session,
                     RealmModel realm,
                     MongoUserEntity userEntity,
                     MongoStoreInvocationContext invContext)

  - ### Method Detail

    - #### getId

          public String getId()

      Specified by:
        `getId` in interface `UserModel`

    - #### getUsername

          public String getUsername()

      Specified by:
        `getUsername` in interface `UserModel`

    - #### setUsername

          public void setUsername(String username)

      Specified by:
        `setUsername` in interface `UserModel`

    - #### isEnabled

          public boolean isEnabled()

      Specified by:
        `isEnabled` in interface `UserModel`

    - #### setEnabled

          public void setEnabled(boolean enabled)

      Specified by:
        `setEnabled` in interface `UserModel`

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

    - #### setAttribute

          public void setAttribute(String name,
                          String value)

      Specified by:
        `setAttribute` in interface `UserModel`

    - #### removeAttribute

          public void removeAttribute(String name)

      Specified by:
        `removeAttribute` in interface `UserModel`

    - #### getAttribute

          public String getAttribute(String name)

      Specified by:
        `getAttribute` in interface `UserModel`

    - #### getAttributes

          public Map<String,String> getAttributes()

      Specified by:
        `getAttributes` in interface `UserModel`

    - #### getUser

          public MongoUserEntity getUser()

    - #### getRequiredActions

          public Set<UserModel.RequiredAction> getRequiredActions()

      Specified by:
        `getRequiredActions` 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`

    - #### isTotp

          public boolean isTotp()

      Specified by:
        `isTotp` in interface `UserModel`

    - #### setTotp

          public void setTotp(boolean totp)

      Specified by:
        `setTotp` 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 credModel)

      Specified by:
        `updateCredentialDirectly` in interface `UserModel`

    - #### updateUser

          protected void updateUser()

    - #### getMongoEntity

          public MongoUserEntity getMongoEntity()

      Specified by:
        `getMongoEntity` in class `AbstractMongoAdapter<MongoUserEntity>`

    - #### hasRole

          public boolean hasRole(RoleModel role)

      Specified by:
        `hasRole` in interface `UserModel`

    - #### grantRole

          public void grantRole(RoleModel role)

      Specified by:
        `grantRole` in interface `UserModel`

    - #### getRoleMappings

          public Set<RoleModel> getRoleMappings()

      Specified by:
        `getRoleMappings` in interface `UserModel`

    - #### getRealmRoleMappings

          public Set<RoleModel> getRealmRoleMappings()

      Specified by:
        `getRealmRoleMappings` in interface `UserModel`

    - #### deleteRoleMapping

          public void deleteRoleMapping(RoleModel role)

      Specified by:
        `deleteRoleMapping` in interface `UserModel`

    - #### getApplicationRoleMappings

          public Set<RoleModel> getApplicationRoleMappings(ApplicationModel app)

      Specified by:
        `getApplicationRoleMappings` in interface `UserModel`

    - #### getFederationLink

          public String getFederationLink()

      Specified by:
        `getFederationLink` in interface `UserModel`

    - #### setFederationLink

          public void setFederationLink(String link)

      Specified by:
        `setFederationLink` in interface `UserModel`

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `AbstractMongoAdapter<MongoUserEntity>`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `AbstractMongoAdapter<MongoUserEntity>`

Copyright © 2014. All Rights Reserved.