I need to add HTTP “Feature-Policy” response header but I did not find any way implement this in spring in header like -
@EnableWebSecurity
public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http
// ...
.headers()
.contentSecurityPolicy("script-src 'self' https://trustedscripts.example.com; object-src https://trustedplugins.example.com; report-uri /csp-report-endpoint/");
}
I can see the draft specification here but not much about use it in Spring. Any suggestion will be appreciated.