org.keycloak.models.sessions.mongo

## Class MongoUserSessionProvider

- java.lang.Object
- - org.keycloak.models.sessions.mongo.MongoUserSessionProvider

- All Implemented Interfaces:
    UserSessionProvider, Provider

      public class MongoUserSessionProvider
      extends Object
      implements UserSessionProvider

  Author:
    Stian Thorgersen

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `MongoUserSessionProvider(KeycloakSession session, MongoStore mongoStore, MongoStoreInvocationContext invocationContext)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `UsernameLoginFailureModel` | `addUserLoginFailure(RealmModel realm, String username)`
    `void` | `close()`
    `ClientSessionModel` | `createClientSession(RealmModel realm, ClientModel client)`
    `UserSessionModel` | `createUserSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe)`
    `int` | `getActiveUserSessions(RealmModel realm, ClientModel client)`
    `ClientSessionModel` | `getClientSession(RealmModel realm, String id)`
    `ClientSessionModel` | `getClientSession(String id)`
    `MongoStore` | `getMongoStore()`
    `UsernameLoginFailureModel` | `getUserLoginFailure(RealmModel realm, String username)`
    `UserSessionModel` | `getUserSession(RealmModel realm, String id)`
    `List<UserSessionModel>` | `getUserSessions(RealmModel realm, ClientModel client)`
    `List<UserSessionModel>` | `getUserSessions(RealmModel realm, ClientModel client, int firstResult, int maxResults)`
    `List<UserSessionModel>` | `getUserSessions(RealmModel realm, UserModel user)`
    `void` | `onClientRemoved(RealmModel realm, ClientModel client)`
    `void` | `onRealmRemoved(RealmModel realm)`
    `void` | `onUserRemoved(RealmModel realm, UserModel user)`
    `void` | `removeExpiredUserSessions(RealmModel realm)`
    `void` | `removeUserSession(RealmModel realm, UserSessionModel session)`
    `void` | `removeUserSessions(RealmModel realm)`
    `void` | `removeUserSessions(RealmModel realm, UserModel user)`

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

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

- - ### Constructor Detail

    - #### MongoUserSessionProvider

          public MongoUserSessionProvider(KeycloakSession session,
                                  MongoStore mongoStore,
                                  MongoStoreInvocationContext invocationContext)

  - ### Method Detail

    - #### getMongoStore

          public MongoStore getMongoStore()

    - #### createClientSession

          public ClientSessionModel createClientSession(RealmModel realm,
                                               ClientModel client)

      Specified by:
        `createClientSession` in interface `UserSessionProvider`

    - #### getClientSession

          public ClientSessionModel getClientSession(RealmModel realm,
                                            String id)

      Specified by:
        `getClientSession` in interface `UserSessionProvider`

    - #### getClientSession

          public ClientSessionModel getClientSession(String id)

      Specified by:
        `getClientSession` in interface `UserSessionProvider`

    - #### createUserSession

          public UserSessionModel createUserSession(RealmModel realm,
                                           UserModel user,
                                           String loginUsername,
                                           String ipAddress,
                                           String authMethod,
                                           boolean rememberMe)

      Specified by:
        `createUserSession` in interface `UserSessionProvider`

    - #### getUserSession

          public UserSessionModel getUserSession(RealmModel realm,
                                        String id)

      Specified by:
        `getUserSession` in interface `UserSessionProvider`

    - #### getUserSessions

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

      Specified by:
        `getUserSessions` in interface `UserSessionProvider`

    - #### getUserSessions

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

      Specified by:
        `getUserSessions` in interface `UserSessionProvider`

    - #### getUserSessions

          public List<UserSessionModel> getUserSessions(RealmModel realm,
                                               ClientModel client,
                                               int firstResult,
                                               int maxResults)

      Specified by:
        `getUserSessions` in interface `UserSessionProvider`

    - #### getActiveUserSessions

          public int getActiveUserSessions(RealmModel realm,
                                  ClientModel client)

      Specified by:
        `getActiveUserSessions` in interface `UserSessionProvider`

    - #### removeUserSession

          public void removeUserSession(RealmModel realm,
                               UserSessionModel session)

      Specified by:
        `removeUserSession` in interface `UserSessionProvider`

    - #### removeUserSessions

          public void removeUserSessions(RealmModel realm,
                                UserModel user)

      Specified by:
        `removeUserSessions` in interface `UserSessionProvider`

    - #### removeUserSessions

          public void removeUserSessions(RealmModel realm)

      Specified by:
        `removeUserSessions` in interface `UserSessionProvider`

    - #### removeExpiredUserSessions

          public void removeExpiredUserSessions(RealmModel realm)

      Specified by:
        `removeExpiredUserSessions` in interface `UserSessionProvider`

    - #### getUserLoginFailure

          public UsernameLoginFailureModel getUserLoginFailure(RealmModel realm,
                                                      String username)

      Specified by:
        `getUserLoginFailure` in interface `UserSessionProvider`

    - #### addUserLoginFailure

          public UsernameLoginFailureModel addUserLoginFailure(RealmModel realm,
                                                      String username)

      Specified by:
        `addUserLoginFailure` in interface `UserSessionProvider`

    - #### onRealmRemoved

          public void onRealmRemoved(RealmModel realm)

      Specified by:
        `onRealmRemoved` in interface `UserSessionProvider`

    - #### onClientRemoved

          public void onClientRemoved(RealmModel realm,
                             ClientModel client)

      Specified by:
        `onClientRemoved` in interface `UserSessionProvider`

    - #### onUserRemoved

          public void onUserRemoved(RealmModel realm,
                           UserModel user)

      Specified by:
        `onUserRemoved` in interface `UserSessionProvider`

    - #### close

          public void close()

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

Copyright © 2015. All Rights Reserved.