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:
SessionPolicy.onLogoutnotification — emitsSESSION_INVALIDATEDaudit when the configured policy wants it.- Core
SubjectClearingLogoutService.logout— drops the cached subject from theSubjectStoreand fans out theLogoutListenerchain. - Browser redirect scheduled via
Page.setLocation(...)— the response carries the redirect, so the next request creates a fresh session even if invalidation happens below. - HTTP session invalidated (when configured).
- 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
ConstructorsConstructorDescriptionVaadinLogoutService(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 explicitSubjectSessionRegistry. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(com.svenruppert.jsentinel.logout.LogoutListener listener) voidlogout(com.svenruppert.jsentinel.logout.SubjectId subjectId, com.svenruppert.jsentinel.logout.LogoutScope scope) voidremoveListener(com.svenruppert.jsentinel.logout.LogoutListener listener)
-
Constructor Details
-
VaadinLogoutService
-
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 onLogoutScope.CurrentSessionsubjectType- subject type tokengateway- Vaadin gateway (redirect / session-invalidate seam)targetRoute- route to redirect to after logoutcloseVaadinSessionOnLogout- iftrue,VaadinLogoutGateway.closeVaadinSession()runs after subject removalinvalidateHttpSessionOnLogout- iftrue,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 explicitSubjectSessionRegistry.- Parameters:
subjectStore- subject store to clear onLogoutScope.CurrentSessionsubjectType- subject type tokengateway- Vaadin gatewaytargetRoute- route to redirect to after logoutcloseVaadinSessionOnLogout- close VaadinSession flaginvalidateHttpSessionOnLogout- invalidate HttpSession flagregistry- session registry used forLogoutScope.AllSessionsOfSubject
-
-
Method Details
-
logout
public void logout(com.svenruppert.jsentinel.logout.SubjectId subjectId, com.svenruppert.jsentinel.logout.LogoutScope scope) - Specified by:
logoutin interfacecom.svenruppert.jsentinel.logout.LogoutService
-
addListener
public void addListener(com.svenruppert.jsentinel.logout.LogoutListener listener) - Specified by:
addListenerin interfacecom.svenruppert.jsentinel.logout.LogoutService
-
removeListener
public void removeListener(com.svenruppert.jsentinel.logout.LogoutListener listener) - Specified by:
removeListenerin interfacecom.svenruppert.jsentinel.logout.LogoutService
-