org.keycloak.adapters.as7

## Class CatalinaUserSessionManagement

- java.lang.Object
- - org.keycloak.adapters.as7.CatalinaUserSessionManagement

- All Implemented Interfaces:
    org.apache.catalina.SessionListener, UserSessionManagement

      public class CatalinaUserSessionManagement
      extends Object
      implements org.apache.catalina.SessionListener, UserSessionManagement

  Manages relationship to users and sessions so that forced admin logout can be implemented
  Version:
    $Revision: 1 $
  Author:
    Bill Burke

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `CatalinaUserSessionManagement.UserSessions`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected ConcurrentHashMap<String,CatalinaUserSessionManagement.UserSessions>` | `keycloakSessionMap`
    `protected ConcurrentHashMap<String,CatalinaUserSessionManagement.UserSessions>` | `userSessionMap`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CatalinaUserSessionManagement()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getActiveSessions()`
    `Set<String>` | `getActiveUsers()`
    `Long` | `getUserLoginTime(String username)`
    `void` | `login(org.apache.catalina.Session session, String username, String keycloakSessionId)`
    `void` | `logoutAll()`
    `void` | `logoutKeycloakSession(String keycloakSessionId)`
    `void` | `logoutUser(String user)`
    `void` | `sessionEvent(org.apache.catalina.SessionEvent event)`

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

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

- - ### Field Detail

    - #### userSessionMap

          protected ConcurrentHashMap<String,CatalinaUserSessionManagement.UserSessions> userSessionMap

    - #### keycloakSessionMap

          protected ConcurrentHashMap<String,CatalinaUserSessionManagement.UserSessions> keycloakSessionMap

  - ### Constructor Detail

    - #### CatalinaUserSessionManagement

          public CatalinaUserSessionManagement()

  - ### Method Detail

    - #### getActiveSessions

          public int getActiveSessions()

      Specified by:
        `getActiveSessions` in interface `UserSessionManagement`

    - #### getUserLoginTime

          public Long getUserLoginTime(String username)

      Specified by:
        `getUserLoginTime` in interface `UserSessionManagement`
      Parameters:
        `username` -
      Returns:
        null if user not logged in

    - #### getActiveUsers

          public Set<String> getActiveUsers()

      Specified by:
        `getActiveUsers` in interface `UserSessionManagement`

    - #### login

          public void login(org.apache.catalina.Session session,
                   String username,
                   String keycloakSessionId)

    - #### logoutAll

          public void logoutAll()

      Specified by:
        `logoutAll` in interface `UserSessionManagement`

    - #### logoutUser

          public void logoutUser(String user)

      Specified by:
        `logoutUser` in interface `UserSessionManagement`

    - #### logoutKeycloakSession

          public void logoutKeycloakSession(String keycloakSessionId)

      Specified by:
        `logoutKeycloakSession` in interface `UserSessionManagement`

    - #### sessionEvent

          public void sessionEvent(org.apache.catalina.SessionEvent event)

      Specified by:
        `sessionEvent` in interface `org.apache.catalina.SessionListener`

Copyright © 2014. All Rights Reserved.