Search in sources :

Example 1 with ServerHttpHeadersWriter

use of org.springframework.security.web.server.header.ServerHttpHeadersWriter in project spring-security by spring-projects.

the class HeaderWriterServerLogoutHandlerTests method logoutWhenInvokedThenWritesResponseHeaders.

@Test
public void logoutWhenInvokedThenWritesResponseHeaders() {
    ServerHttpHeadersWriter headersWriter = mock(ServerHttpHeadersWriter.class);
    HeaderWriterServerLogoutHandler handler = new HeaderWriterServerLogoutHandler(headersWriter);
    ServerWebExchange serverWebExchange = mock(ServerWebExchange.class);
    WebFilterExchange filterExchange = mock(WebFilterExchange.class);
    given(filterExchange.getExchange()).willReturn(serverWebExchange);
    Authentication authentication = mock(Authentication.class);
    handler.logout(filterExchange, authentication);
    verify(headersWriter).writeHttpHeaders(serverWebExchange);
}
Also used : ServerWebExchange(org.springframework.web.server.ServerWebExchange) Authentication(org.springframework.security.core.Authentication) ServerHttpHeadersWriter(org.springframework.security.web.server.header.ServerHttpHeadersWriter) WebFilterExchange(org.springframework.security.web.server.WebFilterExchange) Test(org.junit.jupiter.api.Test)

Aggregations

Test (org.junit.jupiter.api.Test)1 Authentication (org.springframework.security.core.Authentication)1 WebFilterExchange (org.springframework.security.web.server.WebFilterExchange)1 ServerHttpHeadersWriter (org.springframework.security.web.server.header.ServerHttpHeadersWriter)1 ServerWebExchange (org.springframework.web.server.ServerWebExchange)1