use of org.springframework.web.filter.ForwardedHeaderFilter in project spring-framework by spring-projects.
the class WebUtilsTests method adaptFromForwardedHeaders.
// SPR-16668
private HttpServletRequest adaptFromForwardedHeaders(HttpServletRequest request) throws Exception {
MockFilterChain chain = new MockFilterChain();
new ForwardedHeaderFilter().doFilter(request, new MockHttpServletResponse(), chain);
return (HttpServletRequest) chain.getRequest();
}
use of org.springframework.web.filter.ForwardedHeaderFilter in project spring-framework by spring-projects.
the class MvcUriComponentsBuilderTests method adaptRequestFromForwardedHeaders.
// SPR-16668
private void adaptRequestFromForwardedHeaders() throws Exception {
MockFilterChain chain = new MockFilterChain();
new ForwardedHeaderFilter().doFilter(this.request, new MockHttpServletResponse(), chain);
HttpServletRequest adaptedRequest = (HttpServletRequest) chain.getRequest();
RequestContextHolder.setRequestAttributes(new ServletRequestAttributes(adaptedRequest));
}
use of org.springframework.web.filter.ForwardedHeaderFilter in project snow-owl by b2ihealthcare.
the class SnowOwlSecurityConfig method configure.
@SuppressWarnings({ "lgtm[java/spring-disabled-csrf-protection]" })
@Override
protected void configure(final HttpSecurity http) throws Exception {
http.sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and().csrf().disable();
// handle X-Forwarded headers
http.addFilterBefore(new ForwardedHeaderFilter(), BasicAuthenticationFilter.class);
// add dev time CORS filter
if (PlatformUtil.isDevVersion()) {
http.addFilterAfter(new CORSFilter(), BasicAuthenticationFilter.class);
}
// authentication is handled internally in AuthorizedRequest
http.authorizeRequests().antMatchers("/**").permitAll();
}
use of org.springframework.web.filter.ForwardedHeaderFilter in project spring-framework by spring-projects.
the class ServletUriComponentsBuilderTests method adaptFromForwardedHeaders.
// SPR-16668
private HttpServletRequest adaptFromForwardedHeaders(HttpServletRequest request) throws Exception {
MockFilterChain chain = new MockFilterChain();
new ForwardedHeaderFilter().doFilter(request, new MockHttpServletResponse(), chain);
return (HttpServletRequest) chain.getRequest();
}
Aggregations