Class VaadinLogoutService<U>

java.lang.Object
com.svenruppert.jsentinel.logout.vaadin.VaadinLogoutService<U>
Type Parameters:
U - subject type
All Implemented Interfaces:
com.svenruppert.jsentinel.logout.LogoutService

public final class VaadinLogoutService<U> extends Object implements com.svenruppert.jsentinel.logout.LogoutService
Vaadin-aware LogoutService. Wraps a core SubjectClearingLogoutService and adds Vaadin-side cleanup: browser redirect, HTTP-session invalidation, VaadinSession close.

Order of operations on LogoutScope.CurrentSession:

  1. SessionPolicy.onLogout notification — emits SESSION_INVALIDATED audit when the configured policy wants it.
  2. Core SubjectClearingLogoutService.logout — drops the cached subject from the SubjectStore and fans out the LogoutListener chain.
  3. Browser redirect scheduled via Page.setLocation(...) — the response carries the redirect, so the next request creates a fresh session even if invalidation happens below.
  4. HTTP session invalidated (when configured).
  5. Vaadin session closed (when configured).

The Vaadin static APIs are isolated behind VaadinLogoutGateway so this service can be unit-tested without a Vaadin runtime.

  • Constructor Summary

    Constructors
    Constructor
    Description
    VaadinLogoutService(com.svenruppert.jsentinel.authorization.api.SubjectStore subjectStore, Class<U> subjectType)
    Convenience: full-invalidate logout (close VaadinSession + invalidate HttpSession) targeting "/login".
    VaadinLogoutService(com.svenruppert.jsentinel.authorization.api.SubjectStore subjectStore, Class<U> subjectType, VaadinLogoutGateway gateway, String targetRoute, boolean closeVaadinSessionOnLogout, boolean invalidateHttpSessionOnLogout)
    Full constructor.
    VaadinLogoutService(com.svenruppert.jsentinel.authorization.api.SubjectStore subjectStore, Class<U> subjectType, VaadinLogoutGateway gateway, String targetRoute, boolean closeVaadinSessionOnLogout, boolean invalidateHttpSessionOnLogout, com.svenruppert.jsentinel.logout.SubjectSessionRegistry registry)
    Full constructor with explicit SubjectSessionRegistry.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addListener(com.svenruppert.jsentinel.logout.LogoutListener listener)
     
    void
    logout(com.svenruppert.jsentinel.logout.SubjectId subjectId, com.svenruppert.jsentinel.logout.LogoutScope scope)
     
    void
    removeListener(com.svenruppert.jsentinel.logout.LogoutListener listener)
     

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VaadinLogoutService

      public VaadinLogoutService(com.svenruppert.jsentinel.authorization.api.SubjectStore subjectStore, Class<U> subjectType)
      Convenience: full-invalidate logout (close VaadinSession + invalidate HttpSession) targeting "/login".
    • VaadinLogoutService

      public VaadinLogoutService(com.svenruppert.jsentinel.authorization.api.SubjectStore subjectStore, Class<U> subjectType, VaadinLogoutGateway gateway, String targetRoute, boolean closeVaadinSessionOnLogout, boolean invalidateHttpSessionOnLogout)
      Full constructor.
      Parameters:
      subjectStore - subject store to clear on LogoutScope.CurrentSession
      subjectType - subject type token
      gateway - Vaadin gateway (redirect / session-invalidate seam)
      targetRoute - route to redirect to after logout
      closeVaadinSessionOnLogout - if true, VaadinLogoutGateway.closeVaadinSession() runs after subject removal
      invalidateHttpSessionOnLogout - if true, VaadinLogoutGateway.invalidateHttpSession() runs after subject removal
    • VaadinLogoutService

      public VaadinLogoutService(com.svenruppert.jsentinel.authorization.api.SubjectStore subjectStore, Class<U> subjectType, VaadinLogoutGateway gateway, String targetRoute, boolean closeVaadinSessionOnLogout, boolean invalidateHttpSessionOnLogout, com.svenruppert.jsentinel.logout.SubjectSessionRegistry registry)
      Full constructor with explicit SubjectSessionRegistry.
      Parameters:
      subjectStore - subject store to clear on LogoutScope.CurrentSession
      subjectType - subject type token
      gateway - Vaadin gateway
      targetRoute - route to redirect to after logout
      closeVaadinSessionOnLogout - close VaadinSession flag
      invalidateHttpSessionOnLogout - invalidate HttpSession flag
      registry - session registry used for LogoutScope.AllSessionsOfSubject
  • Method Details

    • logout

      public void logout(com.svenruppert.jsentinel.logout.SubjectId subjectId, com.svenruppert.jsentinel.logout.LogoutScope scope)
      Specified by:
      logout in interface com.svenruppert.jsentinel.logout.LogoutService
    • addListener

      public void addListener(com.svenruppert.jsentinel.logout.LogoutListener listener)
      Specified by:
      addListener in interface com.svenruppert.jsentinel.logout.LogoutService
    • removeListener

      public void removeListener(com.svenruppert.jsentinel.logout.LogoutListener listener)
      Specified by:
      removeListener in interface com.svenruppert.jsentinel.logout.LogoutService