use of org.springframework.security.web.header.HeaderWriter in project spring-security by spring-projects.
the class HeaderWriterLogoutHandlerTests method logoutWhenHasHeaderWriterThenInvoked.
@Test
public void logoutWhenHasHeaderWriterThenInvoked() {
HeaderWriter headerWriter = mock(HeaderWriter.class);
HeaderWriterLogoutHandler handler = new HeaderWriterLogoutHandler(headerWriter);
handler.logout(this.request, this.response, mock(Authentication.class));
verify(headerWriter).writeHeaders(this.request, this.response);
}
use of org.springframework.security.web.header.HeaderWriter in project spring-security by spring-projects.
the class HeadersConfigurer method createHeaderWriterFilter.
/**
* Creates the {@link HeaderWriter}
* @return the {@link HeaderWriter}
*/
private HeaderWriterFilter createHeaderWriterFilter() {
List<HeaderWriter> writers = getHeaderWriters();
if (writers.isEmpty()) {
throw new IllegalStateException("Headers security is enabled, but no headers will be added. Either add headers or disable headers security");
}
HeaderWriterFilter headersFilter = new HeaderWriterFilter(writers);
headersFilter = postProcess(headersFilter);
return headersFilter;
}
use of org.springframework.security.web.header.HeaderWriter in project spring-security by spring-projects.
the class CompositeHeaderWriterTests method writeHeadersWhenConfiguredWithDelegatesThenInvokesEach.
@Test
public void writeHeadersWhenConfiguredWithDelegatesThenInvokesEach() {
HttpServletRequest request = mock(HttpServletRequest.class);
HttpServletResponse response = mock(HttpServletResponse.class);
HeaderWriter one = mock(HeaderWriter.class);
HeaderWriter two = mock(HeaderWriter.class);
CompositeHeaderWriter headerWriter = new CompositeHeaderWriter(Arrays.asList(one, two));
headerWriter.writeHeaders(request, response);
verify(one).writeHeaders(request, response);
verify(two).writeHeaders(request, response);
}
Aggregations