use of org.springframework.security.core.session.SessionDestroyedEvent in project ma-core-public by infiniteautomation.
the class MangoWebSocketConfiguration method postConstruct.
@PostConstruct
public void postConstruct() {
// SessionDestroyedEvent from root context are not propagated to the child web context. Register as a listener
// on the parent.
ConfigurableApplicationContext parent = (ConfigurableApplicationContext) context.getParent();
ApplicationListener<SessionDestroyedEvent> listener = this::sessionDestroyed;
parent.addApplicationListener(listener);
}
use of org.springframework.security.core.session.SessionDestroyedEvent in project spring-security by spring-projects.
the class DefaultJaasAuthenticationProviderTests method logoutNullSession.
@Test
public void logoutNullSession() {
SessionDestroyedEvent event = mock(SessionDestroyedEvent.class);
this.provider.handleLogout(event);
verify(event).getSecurityContexts();
verify(this.log).debug(anyString());
verifyNoMoreInteractions(event);
}
use of org.springframework.security.core.session.SessionDestroyedEvent in project spring-security by spring-projects.
the class DefaultJaasAuthenticationProviderTests method logoutNonJaasAuthentication.
@Test
public void logoutNonJaasAuthentication() {
SessionDestroyedEvent event = mock(SessionDestroyedEvent.class);
SecurityContext securityContext = mock(SecurityContext.class);
given(event.getSecurityContexts()).willReturn(Arrays.asList(securityContext));
given(securityContext.getAuthentication()).willReturn(this.token);
this.provider.handleLogout(event);
verify(event).getSecurityContexts();
verify(event).getSecurityContexts();
verify(securityContext).getAuthentication();
verifyNoMoreInteractions(event, securityContext);
}
use of org.springframework.security.core.session.SessionDestroyedEvent in project spring-security by spring-projects.
the class DefaultJaasAuthenticationProviderTests method logoutNullAuthentication.
@Test
public void logoutNullAuthentication() {
SessionDestroyedEvent event = mock(SessionDestroyedEvent.class);
SecurityContext securityContext = mock(SecurityContext.class);
given(event.getSecurityContexts()).willReturn(Arrays.asList(securityContext));
this.provider.handleLogout(event);
verify(event).getSecurityContexts();
verify(event).getSecurityContexts();
verify(securityContext).getAuthentication();
verifyNoMoreInteractions(event, securityContext);
}
use of org.springframework.security.core.session.SessionDestroyedEvent in project spring-security by spring-projects.
the class DefaultJaasAuthenticationProviderTests method logout.
@Test
public void logout() throws Exception {
SessionDestroyedEvent event = mock(SessionDestroyedEvent.class);
SecurityContext securityContext = mock(SecurityContext.class);
JaasAuthenticationToken token = mock(JaasAuthenticationToken.class);
LoginContext context = mock(LoginContext.class);
given(event.getSecurityContexts()).willReturn(Arrays.asList(securityContext));
given(securityContext.getAuthentication()).willReturn(token);
given(token.getLoginContext()).willReturn(context);
this.provider.onApplicationEvent(event);
verify(event).getSecurityContexts();
verify(securityContext).getAuthentication();
verify(token).getLoginContext();
verify(context).logout();
verifyNoMoreInteractions(event, securityContext, token, context);
}
Aggregations