org.keycloak.models.sessions.infinispan

## Class InfinispanUserSessionProvider

- java.lang.Object
- - org.keycloak.models.sessions.infinispan.InfinispanUserSessionProvider

- All Implemented Interfaces:
    UserSessionProvider, Provider

      public class InfinispanUserSessionProvider
      extends Object
      implements UserSessionProvider

  Author:
    Stian Thorgersen

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `InfinispanUserSessionProvider.CacheOperation`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.infinispan.Cache<LoginFailureKey,LoginFailureEntity>` | `loginFailureCache`
    `protected org.infinispan.Cache<String,SessionEntity>` | `offlineSessionCache`
    `protected KeycloakSession` | `session`
    `protected org.infinispan.Cache<String,SessionEntity>` | `sessionCache`
    `protected org.keycloak.models.sessions.infinispan.InfinispanUserSessionProvider.InfinispanKeycloakTransaction` | `tx`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InfinispanUserSessionProvider(KeycloakSession session, org.infinispan.Cache<String,SessionEntity> sessionCache, org.infinispan.Cache<String,SessionEntity> offlineSessionCache, org.infinispan.Cache<LoginFailureKey,LoginFailureEntity> loginFailureCache)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `UserLoginFailureModel` | `addUserLoginFailure(RealmModel realm, String userId)`
    `void` | `close()`
    `ClientInitialAccessModel` | `createClientInitialAccessModel(RealmModel realm, int expiration, int count)`
    `ClientSessionModel` | `createClientSession(RealmModel realm, ClientModel client)`
    `ClientSessionModel` | `createOfflineClientSession(ClientSessionModel clientSession)`
    `UserSessionModel` | `createOfflineUserSession(UserSessionModel userSession)`
    `UserSessionModel` | `createUserSession(RealmModel realm, UserModel user, String loginUsername, String ipAddress, String authMethod, boolean rememberMe, String brokerSessionId, String brokerUserId)`
    `long` | `getActiveUserSessions(RealmModel realm, ClientModel client)`
    `protected org.infinispan.Cache<String,SessionEntity>` | `getCache(boolean offline)`
    `ClientInitialAccessModel` | `getClientInitialAccessModel(RealmModel realm, String id)`
    `ClientSessionModel` | `getClientSession(RealmModel realm, String id)`
    `protected ClientSessionModel` | `getClientSession(RealmModel realm, String id, boolean offline)`
    `ClientSessionModel` | `getClientSession(String id)`
    `ClientSessionModel` | `getOfflineClientSession(RealmModel realm, String clientSessionId)`
    `List<ClientSessionModel>` | `getOfflineClientSessions(RealmModel realm, UserModel user)`
    `long` | `getOfflineSessionsCount(RealmModel realm, ClientModel client)`
    `UserSessionModel` | `getOfflineUserSession(RealmModel realm, String userSessionId)`
    `List<UserSessionModel>` | `getOfflineUserSessions(RealmModel realm, ClientModel client, int first, int max)`
    `UserLoginFailureModel` | `getUserLoginFailure(RealmModel realm, String userId)`
    `UserSessionModel` | `getUserSession(RealmModel realm, String id)`
    `protected UserSessionAdapter` | `getUserSession(RealmModel realm, String id, boolean offline)`
    `UserSessionModel` | `getUserSessionByBrokerSessionId(RealmModel realm, String brokerSessionId)`
    `List<UserSessionModel>` | `getUserSessionByBrokerUserId(RealmModel realm, String brokerUserId)`
    `List<UserSessionModel>` | `getUserSessions(RealmModel realm, ClientModel client)`
    `List<UserSessionModel>` | `getUserSessions(RealmModel realm, ClientModel client, int firstResult, int maxResults)`
    `protected List<UserSessionModel>` | `getUserSessions(RealmModel realm, ClientModel client, int firstResult, int maxResults, boolean offline)`
    `protected List<UserSessionModel>` | `getUserSessions(RealmModel realm, java.util.function.Predicate<Map.Entry<String,SessionEntity>> predicate, boolean offline)`
    `List<UserSessionModel>` | `getUserSessions(RealmModel realm, UserModel user)`
    `protected long` | `getUserSessionsCount(RealmModel realm, ClientModel client, boolean offline)`
    `ClientSessionAdapter` | `importClientSession(ClientSessionModel clientSession, boolean offline)`
    `UserSessionAdapter` | `importUserSession(UserSessionModel userSession, boolean offline)`
    `List<ClientInitialAccessModel>` | `listClientInitialAccess(RealmModel realm)`
    `void` | `onClientRemoved(RealmModel realm, ClientModel client)`
    `void` | `onRealmRemoved(RealmModel realm)`
    `void` | `onUserRemoved(RealmModel realm, UserModel user)`
    `void` | `removeAllUserLoginFailures(RealmModel realm)`
    `void` | `removeClientInitialAccessModel(RealmModel realm, String id)`
    `void` | `removeClientSession(RealmModel realm, ClientSessionModel clientSession)`
    `protected void` | `removeClientSession(RealmModel realm, ClientSessionModel clientSession, boolean offline)`
    `void` | `removeExpired(RealmModel realm)`
    `void` | `removeOfflineClientSession(RealmModel realm, String clientSessionId)`
    `void` | `removeOfflineUserSession(RealmModel realm, UserSessionModel userSession)`
    `void` | `removeUserLoginFailure(RealmModel realm, String userId)`
    `protected void` | `removeUserSession(RealmModel realm, UserSessionEntity sessionEntity, boolean offline)`
    `void` | `removeUserSession(RealmModel realm, UserSessionModel session)`
    `void` | `removeUserSessions(RealmModel realm)`
    `protected void` | `removeUserSessions(RealmModel realm, boolean offline)`
    `void` | `removeUserSessions(RealmModel realm, UserModel user)`
    `protected void` | `removeUserSessions(RealmModel realm, UserModel user, boolean offline)`

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

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

- - ### Field Detail

    - #### session

          protected final KeycloakSession session

    - #### sessionCache

          protected final org.infinispan.Cache<String,SessionEntity> sessionCache

    - #### offlineSessionCache

          protected final org.infinispan.Cache<String,SessionEntity> offlineSessionCache

    - #### loginFailureCache

          protected final org.infinispan.Cache<LoginFailureKey,LoginFailureEntity> loginFailureCache

    - #### tx

          protected final org.keycloak.models.sessions.infinispan.InfinispanUserSessionProvider.InfinispanKeycloakTransaction tx

  - ### Constructor Detail

    - #### InfinispanUserSessionProvider

          public InfinispanUserSessionProvider(KeycloakSession session,
                                               org.infinispan.Cache<String,SessionEntity> sessionCache,
                                               org.infinispan.Cache<String,SessionEntity> offlineSessionCache,
                                               org.infinispan.Cache<LoginFailureKey,LoginFailureEntity> loginFailureCache)

  - ### Method Detail

    - #### getCache

          protected org.infinispan.Cache<String,SessionEntity> getCache(boolean offline)

    - #### createClientSession

          public ClientSessionModel createClientSession(RealmModel realm,
                                                        ClientModel client)

      Specified by:
        `createClientSession` in interface `UserSessionProvider`

    - #### createUserSession

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

      Specified by:
        `createUserSession` in interface `UserSessionProvider`

    - #### getClientSession

          public ClientSessionModel getClientSession(RealmModel realm,
                                                     String id)

      Specified by:
        `getClientSession` in interface `UserSessionProvider`

    - #### getClientSession

          protected ClientSessionModel getClientSession(RealmModel realm,
                                                        String id,
                                                        boolean offline)

    - #### getClientSession

          public ClientSessionModel getClientSession(String id)

      Specified by:
        `getClientSession` in interface `UserSessionProvider`

    - #### getUserSession

          public UserSessionModel getUserSession(RealmModel realm,
                                                 String id)

      Specified by:
        `getUserSession` in interface `UserSessionProvider`

    - #### getUserSession

          protected UserSessionAdapter getUserSession(RealmModel realm,
                                                      String id,
                                                      boolean offline)

    - #### getUserSessions

          protected List<UserSessionModel> getUserSessions(RealmModel realm,
                                                           java.util.function.Predicate<Map.Entry<String,SessionEntity>> predicate,
                                                           boolean offline)

    - #### getUserSessions

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

      Specified by:
        `getUserSessions` in interface `UserSessionProvider`

    - #### getUserSessionByBrokerUserId

          public List<UserSessionModel> getUserSessionByBrokerUserId(RealmModel realm,
                                                                     String brokerUserId)

      Specified by:
        `getUserSessionByBrokerUserId` in interface `UserSessionProvider`

    - #### getUserSessionByBrokerSessionId

          public UserSessionModel getUserSessionByBrokerSessionId(RealmModel realm,
                                                                  String brokerSessionId)

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

    - #### getUserSessions

          protected List<UserSessionModel> getUserSessions(RealmModel realm,
                                                           ClientModel client,
                                                           int firstResult,
                                                           int maxResults,
                                                           boolean offline)

    - #### getActiveUserSessions

          public long getActiveUserSessions(RealmModel realm,
                                            ClientModel client)

      Specified by:
        `getActiveUserSessions` in interface `UserSessionProvider`

    - #### getUserSessionsCount

          protected long getUserSessionsCount(RealmModel realm,
                                              ClientModel client,
                                              boolean offline)

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

          protected void removeUserSessions(RealmModel realm,
                                            UserModel user,
                                            boolean offline)

    - #### removeExpired

          public void removeExpired(RealmModel realm)

      Specified by:
        `removeExpired` in interface `UserSessionProvider`

    - #### removeUserSessions

          public void removeUserSessions(RealmModel realm)

      Specified by:
        `removeUserSessions` in interface `UserSessionProvider`

    - #### removeUserSessions

          protected void removeUserSessions(RealmModel realm,
                                            boolean offline)

    - #### getUserLoginFailure

          public UserLoginFailureModel getUserLoginFailure(RealmModel realm,
                                                           String userId)

      Specified by:
        `getUserLoginFailure` in interface `UserSessionProvider`

    - #### addUserLoginFailure

          public UserLoginFailureModel addUserLoginFailure(RealmModel realm,
                                                           String userId)

      Specified by:
        `addUserLoginFailure` in interface `UserSessionProvider`

    - #### removeUserLoginFailure

          public void removeUserLoginFailure(RealmModel realm,
                                             String userId)

      Specified by:
        `removeUserLoginFailure` in interface `UserSessionProvider`

    - #### removeAllUserLoginFailures

          public void removeAllUserLoginFailures(RealmModel realm)

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

    - #### removeClientSession

          public void removeClientSession(RealmModel realm,
                                          ClientSessionModel clientSession)

      Specified by:
        `removeClientSession` in interface `UserSessionProvider`

    - #### removeClientSession

          protected void removeClientSession(RealmModel realm,
                                             ClientSessionModel clientSession,
                                             boolean offline)

    - #### removeUserSession

          protected void removeUserSession(RealmModel realm,
                                           UserSessionEntity sessionEntity,
                                           boolean offline)

    - #### createOfflineUserSession

          public UserSessionModel createOfflineUserSession(UserSessionModel userSession)

      Specified by:
        `createOfflineUserSession` in interface `UserSessionProvider`

    - #### getOfflineUserSession

          public UserSessionModel getOfflineUserSession(RealmModel realm,
                                                        String userSessionId)

      Specified by:
        `getOfflineUserSession` in interface `UserSessionProvider`

    - #### removeOfflineUserSession

          public void removeOfflineUserSession(RealmModel realm,
                                               UserSessionModel userSession)

      Specified by:
        `removeOfflineUserSession` in interface `UserSessionProvider`

    - #### createOfflineClientSession

          public ClientSessionModel createOfflineClientSession(ClientSessionModel clientSession)

      Specified by:
        `createOfflineClientSession` in interface `UserSessionProvider`

    - #### getOfflineClientSession

          public ClientSessionModel getOfflineClientSession(RealmModel realm,
                                                            String clientSessionId)

      Specified by:
        `getOfflineClientSession` in interface `UserSessionProvider`

    - #### getOfflineClientSessions

          public List<ClientSessionModel> getOfflineClientSessions(RealmModel realm,
                                                                   UserModel user)

      Specified by:
        `getOfflineClientSessions` in interface `UserSessionProvider`

    - #### removeOfflineClientSession

          public void removeOfflineClientSession(RealmModel realm,
                                                 String clientSessionId)

      Specified by:
        `removeOfflineClientSession` in interface `UserSessionProvider`

    - #### getOfflineSessionsCount

          public long getOfflineSessionsCount(RealmModel realm,
                                              ClientModel client)

      Specified by:
        `getOfflineSessionsCount` in interface `UserSessionProvider`

    - #### getOfflineUserSessions

          public List<UserSessionModel> getOfflineUserSessions(RealmModel realm,
                                                               ClientModel client,
                                                               int first,
                                                               int max)

      Specified by:
        `getOfflineUserSessions` in interface `UserSessionProvider`

    - #### importUserSession

          public UserSessionAdapter importUserSession(UserSessionModel userSession,
                                                      boolean offline)

      Specified by:
        `importUserSession` in interface `UserSessionProvider`

    - #### importClientSession

          public ClientSessionAdapter importClientSession(ClientSessionModel clientSession,
                                                          boolean offline)

      Specified by:
        `importClientSession` in interface `UserSessionProvider`

    - #### createClientInitialAccessModel

          public ClientInitialAccessModel createClientInitialAccessModel(RealmModel realm,
                                                                         int expiration,
                                                                         int count)

      Specified by:
        `createClientInitialAccessModel` in interface `UserSessionProvider`

    - #### getClientInitialAccessModel

          public ClientInitialAccessModel getClientInitialAccessModel(RealmModel realm,
                                                                      String id)

      Specified by:
        `getClientInitialAccessModel` in interface `UserSessionProvider`

    - #### removeClientInitialAccessModel

          public void removeClientInitialAccessModel(RealmModel realm,
                                                     String id)

      Specified by:
        `removeClientInitialAccessModel` in interface `UserSessionProvider`

    - #### listClientInitialAccess

          public List<ClientInitialAccessModel> listClientInitialAccess(RealmModel realm)

      Specified by:
        `listClientInitialAccess` in interface `UserSessionProvider`

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