org.keycloak.models.mongo.keycloak.adapters

## Class MongoKeycloakSession

- java.lang.Object
- - org.keycloak.models.mongo.keycloak.adapters.MongoKeycloakSession

- All Implemented Interfaces:
    KeycloakSession, Provider

      public class MongoKeycloakSession
      extends Object
      implements KeycloakSession

  Author:
    Marek Posolda

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MongoKeycloakSession(MongoStore mongoStore)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `UsernameLoginFailureModel` | `addUserLoginFailure(String username, RealmModel realm)`
    `void` | `close()`
    `protected List<UserModel>` | `convertUserEntities(RealmModel realm, List<MongoUserEntity> userEntities)`
    `RealmModel` | `createRealm(String name)`
    `RealmModel` | `createRealm(String id, String name)`
    `UserSessionModel` | `createUserSession(RealmModel realm, UserModel user, String ipAddress)`
    `int` | `getActiveUserSessions(RealmModel realm, ClientModel client)`
    `List<UsernameLoginFailureModel>` | `getAllUserLoginFailures(RealmModel realm)`
    `ApplicationModel` | `getApplicationById(String id, RealmModel realm)`
    `protected MongoStore` | `getMongoStore()`
    `OAuthClientModel` | `getOAuthClientById(String id, RealmModel realm)`
    `RealmModel` | `getRealm(String id)`
    `RealmModel` | `getRealmByName(String name)`
    `List<RealmModel>` | `getRealms()`
    `RoleModel` | `getRoleById(String id, RealmModel realm)`
    `SocialLinkModel` | `getSocialLink(UserModel user, String socialProvider, RealmModel realm)`
    `Set<SocialLinkModel>` | `getSocialLinks(UserModel user, RealmModel realm)`
    `KeycloakTransaction` | `getTransaction()`
    `UserModel` | `getUserByEmail(String email, RealmModel realm)`
    `UserModel` | `getUserById(String id, RealmModel realm)`
    `UserModel` | `getUserBySocialLink(SocialLinkModel socialLink, RealmModel realm)`
    `UserModel` | `getUserByUsername(String username, RealmModel realm)`
    `UsernameLoginFailureModel` | `getUserLoginFailure(String username, RealmModel realm)`
    `List<UserModel>` | `getUsers(RealmModel realm)`
    `UserSessionModel` | `getUserSession(String id, RealmModel realm)`
    `Set<UserSessionModel>` | `getUserSessions(RealmModel realm, ClientModel client)`
    `List<UserSessionModel>` | `getUserSessions(UserModel user, RealmModel realm)`
    `void` | `removeAllData()`
    `void` | `removeExpiredUserSessions(RealmModel realm)`
    `boolean` | `removeRealm(String id)`
    `void` | `removeUserSession(UserSessionModel session)`
    `void` | `removeUserSessions(RealmModel realm)`
    `void` | `removeUserSessions(RealmModel realm, UserModel user)`
    `List<UserModel>` | `searchForUser(String search, RealmModel realm)`
    `List<UserModel>` | `searchForUserByAttributes(Map<String,String> attributes, RealmModel realm)`

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

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

- - ### Constructor Detail

    - #### MongoKeycloakSession

          public MongoKeycloakSession(MongoStore mongoStore)

  - ### Method Detail

    - #### getTransaction

          public KeycloakTransaction getTransaction()

      Specified by:
        `getTransaction` in interface `KeycloakSession`

    - #### close

          public void close()

      Specified by:
        `close` in interface `KeycloakSession`
      Specified by:
        `close` in interface `Provider`

    - #### removeAllData

          public void removeAllData()

      Specified by:
        `removeAllData` in interface `KeycloakSession`

    - #### createRealm

          public RealmModel createRealm(String name)

      Specified by:
        `createRealm` in interface `KeycloakSession`

    - #### createRealm

          public RealmModel createRealm(String id,
                               String name)

      Specified by:
        `createRealm` in interface `KeycloakSession`

    - #### getRealm

          public RealmModel getRealm(String id)

      Specified by:
        `getRealm` in interface `KeycloakSession`

    - #### getRealms

          public List<RealmModel> getRealms()

      Specified by:
        `getRealms` in interface `KeycloakSession`

    - #### getRealmByName

          public RealmModel getRealmByName(String name)

      Specified by:
        `getRealmByName` in interface `KeycloakSession`

    - #### getUserById

          public UserModel getUserById(String id,
                              RealmModel realm)

      Specified by:
        `getUserById` in interface `KeycloakSession`

    - #### getUserByUsername

          public UserModel getUserByUsername(String username,
                                    RealmModel realm)

      Specified by:
        `getUserByUsername` in interface `KeycloakSession`

    - #### getUserByEmail

          public UserModel getUserByEmail(String email,
                                 RealmModel realm)

      Specified by:
        `getUserByEmail` in interface `KeycloakSession`

    - #### removeRealm

          public boolean removeRealm(String id)

      Specified by:
        `removeRealm` in interface `KeycloakSession`

    - #### getMongoStore

          protected MongoStore getMongoStore()

    - #### getUserBySocialLink

          public UserModel getUserBySocialLink(SocialLinkModel socialLink,
                                      RealmModel realm)

      Specified by:
        `getUserBySocialLink` in interface `KeycloakSession`

    - #### convertUserEntities

          protected List<UserModel> convertUserEntities(RealmModel realm,
                                            List<MongoUserEntity> userEntities)

    - #### getUsers

          public List<UserModel> getUsers(RealmModel realm)

      Specified by:
        `getUsers` in interface `KeycloakSession`

    - #### searchForUser

          public List<UserModel> searchForUser(String search,
                                      RealmModel realm)

      Specified by:
        `searchForUser` in interface `KeycloakSession`

    - #### searchForUserByAttributes

          public List<UserModel> searchForUserByAttributes(Map<String,String> attributes,
                                                  RealmModel realm)

      Specified by:
        `searchForUserByAttributes` in interface `KeycloakSession`

    - #### getSocialLinks

          public Set<SocialLinkModel> getSocialLinks(UserModel user,
                                            RealmModel realm)

      Specified by:
        `getSocialLinks` in interface `KeycloakSession`

    - #### getSocialLink

          public SocialLinkModel getSocialLink(UserModel user,
                                      String socialProvider,
                                      RealmModel realm)

      Specified by:
        `getSocialLink` in interface `KeycloakSession`

    - #### getRoleById

          public RoleModel getRoleById(String id,
                              RealmModel realm)

      Specified by:
        `getRoleById` in interface `KeycloakSession`

    - #### getApplicationById

          public ApplicationModel getApplicationById(String id,
                                            RealmModel realm)

      Specified by:
        `getApplicationById` in interface `KeycloakSession`

    - #### getOAuthClientById

          public OAuthClientModel getOAuthClientById(String id,
                                            RealmModel realm)

      Specified by:
        `getOAuthClientById` in interface `KeycloakSession`

    - #### getUserLoginFailure

          public UsernameLoginFailureModel getUserLoginFailure(String username,
                                                      RealmModel realm)

      Specified by:
        `getUserLoginFailure` in interface `KeycloakSession`

    - #### addUserLoginFailure

          public UsernameLoginFailureModel addUserLoginFailure(String username,
                                                      RealmModel realm)

      Specified by:
        `addUserLoginFailure` in interface `KeycloakSession`

    - #### getAllUserLoginFailures

          public List<UsernameLoginFailureModel> getAllUserLoginFailures(RealmModel realm)

      Specified by:
        `getAllUserLoginFailures` in interface `KeycloakSession`

    - #### createUserSession

          public UserSessionModel createUserSession(RealmModel realm,
                                           UserModel user,
                                           String ipAddress)

      Specified by:
        `createUserSession` in interface `KeycloakSession`

    - #### getUserSession

          public UserSessionModel getUserSession(String id,
                                        RealmModel realm)

      Specified by:
        `getUserSession` in interface `KeycloakSession`

    - #### getUserSessions

          public List<UserSessionModel> getUserSessions(UserModel user,
                                               RealmModel realm)

      Specified by:
        `getUserSessions` in interface `KeycloakSession`

    - #### getUserSessions

          public Set<UserSessionModel> getUserSessions(RealmModel realm,
                                              ClientModel client)

      Specified by:
        `getUserSessions` in interface `KeycloakSession`

    - #### getActiveUserSessions

          public int getActiveUserSessions(RealmModel realm,
                                  ClientModel client)

      Specified by:
        `getActiveUserSessions` in interface `KeycloakSession`

    - #### removeUserSession

          public void removeUserSession(UserSessionModel session)

      Specified by:
        `removeUserSession` in interface `KeycloakSession`

    - #### removeUserSessions

          public void removeUserSessions(RealmModel realm,
                                UserModel user)

      Specified by:
        `removeUserSessions` in interface `KeycloakSession`

    - #### removeUserSessions

          public void removeUserSessions(RealmModel realm)

      Specified by:
        `removeUserSessions` in interface `KeycloakSession`

    - #### removeExpiredUserSessions

          public void removeExpiredUserSessions(RealmModel realm)

      Specified by:
        `removeExpiredUserSessions` in interface `KeycloakSession`

Copyright © 2014. All Rights Reserved.