org.springframework.security.core.session.SessionDestroyedEvent Java Examples
The following examples show how to use
org.springframework.security.core.session.SessionDestroyedEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CurationServiceImpl.java From inception with Apache License 2.0 | 6 votes |
@EventListener @Transactional public void onSessionDestroyed(SessionDestroyedEvent event) { SessionInformation info = sessionRegistry.getSessionInformation(event.getId()); if (info == null) { return; } User user = userRegistry.get((String) info.getPrincipal()); if (user == null) { // This happens e.g. when a session for "anonymousUser" is destroyed or if (for some // reason), the user owning the session no longer exists in the system. return; } storeCurationSettings(user); clearState(user); }
Example #2
Source File: RecommendationServiceImpl.java From inception with Apache License 2.0 | 5 votes |
@EventListener @Order(Ordered.HIGHEST_PRECEDENCE) public void onSessionDestroyed(SessionDestroyedEvent event) { SessionInformation info = sessionRegistry.getSessionInformation(event.getId()); // Could be an anonymous session without information. if (info != null) { String username = (String) info.getPrincipal(); clearState(username); schedulingService.stopAllTasksForUser(username); } }
Example #3
Source File: GenericEventAdapter.java From inception with Apache License 2.0 | 5 votes |
@Override public boolean accepts(Object aEvent) { return aEvent instanceof ApplicationEvent && !( aEvent instanceof ApplicationContextEvent || aEvent instanceof ServletRequestHandledEvent || aEvent instanceof SessionCreationEvent || aEvent instanceof SessionDestroyedEvent || aEvent instanceof AbstractAuthorizationEvent || aEvent instanceof AbstractAuthenticationEvent || aEvent instanceof WebServerInitializedEvent); }
Example #4
Source File: AbstractHttpSessionListenerTests.java From spring-session with Apache License 2.0 | 5 votes |
@Test void springSessionDestroyedTranslatedToSpringSecurityDestroyed() { Session session = new MapSession(); this.publisher.publishEvent(new org.springframework.session.events.SessionDestroyedEvent(this, session)); assertThat(this.listener.getEvent().getId()).isEqualTo(session.getId()); }
Example #5
Source File: RedisSessionRegistry.java From albedo with GNU Lesser General Public License v3.0 | 4 votes |
@Override public void onApplicationEvent(SessionDestroyedEvent event) { String sessionId = event.getId(); removeSessionInformation(sessionId); }
Example #6
Source File: AbstractHttpSessionListenerTests.java From spring-session with Apache License 2.0 | 4 votes |
@Override public void onApplicationEvent(SessionDestroyedEvent event) { this.event = event; }
Example #7
Source File: AbstractHttpSessionListenerTests.java From spring-session with Apache License 2.0 | 4 votes |
SessionDestroyedEvent getEvent() { return this.event; }