Search in sources :

Example 6 with LogoutFilter

use of org.springframework.security.web.authentication.logout.LogoutFilter in project spring-security by spring-projects.

the class Saml2LogoutConfigurer method createRelyingPartyLogoutFilter.

private LogoutFilter createRelyingPartyLogoutFilter(RelyingPartyRegistrationResolver registrations) {
    LogoutHandler[] logoutHandlers = this.logoutHandlers.toArray(new LogoutHandler[0]);
    Saml2RelyingPartyInitiatedLogoutSuccessHandler logoutRequestSuccessHandler = createSaml2LogoutRequestSuccessHandler(registrations);
    LogoutFilter logoutFilter = new LogoutFilter(logoutRequestSuccessHandler, logoutHandlers);
    logoutFilter.setLogoutRequestMatcher(createLogoutMatcher());
    return postProcess(logoutFilter);
}
Also used : CsrfLogoutHandler(org.springframework.security.web.csrf.CsrfLogoutHandler) LogoutSuccessEventPublishingLogoutHandler(org.springframework.security.web.authentication.logout.LogoutSuccessEventPublishingLogoutHandler) SecurityContextLogoutHandler(org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler) LogoutHandler(org.springframework.security.web.authentication.logout.LogoutHandler) LogoutFilter(org.springframework.security.web.authentication.logout.LogoutFilter) Saml2RelyingPartyInitiatedLogoutSuccessHandler(org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2RelyingPartyInitiatedLogoutSuccessHandler)

Example 7 with LogoutFilter

use of org.springframework.security.web.authentication.logout.LogoutFilter in project spring-security by spring-projects.

the class LogoutConfigurer method configure.

@Override
public void configure(H http) throws Exception {
    LogoutFilter logoutFilter = createLogoutFilter(http);
    http.addFilter(logoutFilter);
}
Also used : LogoutFilter(org.springframework.security.web.authentication.logout.LogoutFilter)

Example 8 with LogoutFilter

use of org.springframework.security.web.authentication.logout.LogoutFilter in project spring-security by spring-projects.

the class SessionManagementConfigTests method checkConcurrencyAndLogoutFilterHasSameSizeAndHasLogoutSuccessEventPublishingLogoutHandler.

/**
 * SEC-2680
 */
@Test
public void checkConcurrencyAndLogoutFilterHasSameSizeAndHasLogoutSuccessEventPublishingLogoutHandler() {
    this.spring.configLocations(xml("ConcurrencyControlLogoutAndRememberMeHandlers")).autowire();
    ConcurrentSessionFilter concurrentSessionFilter = getFilter(ConcurrentSessionFilter.class);
    LogoutFilter logoutFilter = getFilter(LogoutFilter.class);
    LogoutHandler csfLogoutHandler = getFieldValue(concurrentSessionFilter, "handlers");
    LogoutHandler lfLogoutHandler = getFieldValue(logoutFilter, "handler");
    assertThat(csfLogoutHandler).isInstanceOf(CompositeLogoutHandler.class);
    assertThat(lfLogoutHandler).isInstanceOf(CompositeLogoutHandler.class);
    List<LogoutHandler> csfLogoutHandlers = getFieldValue(csfLogoutHandler, "logoutHandlers");
    List<LogoutHandler> lfLogoutHandlers = getFieldValue(lfLogoutHandler, "logoutHandlers");
    assertThat(csfLogoutHandlers).hasSameSizeAs(lfLogoutHandlers);
    assertThat(csfLogoutHandlers).hasAtLeastOneElementOfType(LogoutSuccessEventPublishingLogoutHandler.class);
    assertThat(lfLogoutHandlers).hasAtLeastOneElementOfType(LogoutSuccessEventPublishingLogoutHandler.class);
}
Also used : ConcurrentSessionFilter(org.springframework.security.web.session.ConcurrentSessionFilter) LogoutFilter(org.springframework.security.web.authentication.logout.LogoutFilter) LogoutSuccessEventPublishingLogoutHandler(org.springframework.security.web.authentication.logout.LogoutSuccessEventPublishingLogoutHandler) LogoutHandler(org.springframework.security.web.authentication.logout.LogoutHandler) CompositeLogoutHandler(org.springframework.security.web.authentication.logout.CompositeLogoutHandler) Test(org.junit.jupiter.api.Test)

Aggregations

LogoutFilter (org.springframework.security.web.authentication.logout.LogoutFilter)8 LogoutHandler (org.springframework.security.web.authentication.logout.LogoutHandler)5 LogoutSuccessEventPublishingLogoutHandler (org.springframework.security.web.authentication.logout.LogoutSuccessEventPublishingLogoutHandler)4 SecurityContextLogoutHandler (org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler)4 Test (org.junit.jupiter.api.Test)2 CompositeLogoutHandler (org.springframework.security.web.authentication.logout.CompositeLogoutHandler)2 Bean (org.springframework.context.annotation.Bean)1 Saml2RelyingPartyInitiatedLogoutSuccessHandler (org.springframework.security.saml2.provider.service.web.authentication.logout.Saml2RelyingPartyInitiatedLogoutSuccessHandler)1 CookieClearingLogoutHandler (org.springframework.security.web.authentication.logout.CookieClearingLogoutHandler)1 CsrfLogoutHandler (org.springframework.security.web.csrf.CsrfLogoutHandler)1 SecurityContextHolderAwareRequestFilter (org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter)1 ConcurrentSessionFilter (org.springframework.security.web.session.ConcurrentSessionFilter)1