Class SessionManagementView

java.lang.Object
com.vaadin.flow.component.Component
com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
com.svenruppert.jsentinel.components.SessionManagementView
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasStyle, Serializable

@ExperimentalJSentinelApi public class SessionManagementView extends com.vaadin.flow.component.Composite<com.vaadin.flow.component.orderedlayout.VerticalLayout>
Reusable session-management UI for security administrators.

Renders every persisted SessionRecord from the supplied SessionStore as a Grid row showing tenant, subject, session id, status, created-at, last-activity-at, and the security version snapshot. Each row carries a Revoke button; clicking it invokes the supplied revoke callback (typically LogoutService.logout(subjectId, CurrentSession) or a direct SessionStore.delete).

Apps integrate by subclassing, annotating with @Route(...) and the desired permission annotation:

  @Route("admin/sessions")
  @RequiresPermission("admin:sessions")
  public class AdminSessionsView extends SessionManagementView {
    public AdminSessionsView() {
      super(MyServices.sessionStore(), MyServices.revoker());
    }
  }

The view does not subscribe to live updates — the grid snapshots the store on construction and on every refresh() call. Apps that want auto-refresh can wire a polling timer via UI.setPollInterval(...) and call refresh() from a PollEvent listener.

See Also:
  • Constructor Summary

    Constructors
    Constructor
    Description
    SessionManagementView(com.svenruppert.jsentinel.session.SessionStore sessionStore, Consumer<com.svenruppert.jsentinel.session.SessionRecord> revoke)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final com.vaadin.flow.component.grid.Grid<com.svenruppert.jsentinel.session.SessionRecord>
     
    final void
    Re-reads SessionStore.findAll() and rebinds the grid.
    final com.svenruppert.jsentinel.session.SessionStore
     

    Methods inherited from class com.vaadin.flow.component.Composite

    getChildren, getContent, getElement, initContent

    Methods inherited from class com.vaadin.flow.component.Component

    addListener, bindVisible, findAncestor, fireEvent, from, get, getEventBus, getId, getListeners, getLocale, getParent, getTestId, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setTestId, setVisible

    Methods inherited from class Object

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

    Methods inherited from interface com.vaadin.flow.component.AttachNotifier

    addAttachListener

    Methods inherited from interface com.vaadin.flow.component.DetachNotifier

    addDetachListener

    Methods inherited from interface com.vaadin.flow.component.HasStyle

    addClassName, addClassNames, bindClassName, bindClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
  • Constructor Details

    • SessionManagementView

      public SessionManagementView(com.svenruppert.jsentinel.session.SessionStore sessionStore, Consumer<com.svenruppert.jsentinel.session.SessionRecord> revoke)
      Parameters:
      sessionStore - source of session records; non-null
      revoke - callback invoked when an admin clicks Revoke on a row; non-null. Implementations typically delete the record from the store and emit a LogoutPerformed audit event
  • Method Details

    • refresh

      public final void refresh()
      Re-reads SessionStore.findAll() and rebinds the grid. Apps call this after a known mutation (e.g. from an external audit event) to keep the view current.
    • grid

      public final com.vaadin.flow.component.grid.Grid<com.svenruppert.jsentinel.session.SessionRecord> grid()
      Returns:
      the grid the view renders — exposed for tests
    • sessionStore

      public final com.svenruppert.jsentinel.session.SessionStore sessionStore()
      Returns:
      the SessionStore the view was constructed with