Search in sources :

Example 1 with HeaderWriterFilter

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

the class HeadersConfigurer method configure.

@Override
public void configure(H http) {
    HeaderWriterFilter headersFilter = createHeaderWriterFilter();
    http.addFilter(headersFilter);
}
Also used : HeaderWriterFilter(org.springframework.security.web.header.HeaderWriterFilter)

Example 2 with HeaderWriterFilter

use of org.springframework.security.web.header.HeaderWriterFilter 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;
}
Also used : HstsHeaderWriter(org.springframework.security.web.header.writers.HstsHeaderWriter) ContentSecurityPolicyHeaderWriter(org.springframework.security.web.header.writers.ContentSecurityPolicyHeaderWriter) ReferrerPolicyHeaderWriter(org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter) HpkpHeaderWriter(org.springframework.security.web.header.writers.HpkpHeaderWriter) FeaturePolicyHeaderWriter(org.springframework.security.web.header.writers.FeaturePolicyHeaderWriter) HeaderWriter(org.springframework.security.web.header.HeaderWriter) XContentTypeOptionsHeaderWriter(org.springframework.security.web.header.writers.XContentTypeOptionsHeaderWriter) XXssProtectionHeaderWriter(org.springframework.security.web.header.writers.XXssProtectionHeaderWriter) PermissionsPolicyHeaderWriter(org.springframework.security.web.header.writers.PermissionsPolicyHeaderWriter) CrossOriginEmbedderPolicyHeaderWriter(org.springframework.security.web.header.writers.CrossOriginEmbedderPolicyHeaderWriter) CrossOriginResourcePolicyHeaderWriter(org.springframework.security.web.header.writers.CrossOriginResourcePolicyHeaderWriter) CrossOriginOpenerPolicyHeaderWriter(org.springframework.security.web.header.writers.CrossOriginOpenerPolicyHeaderWriter) XFrameOptionsHeaderWriter(org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter) HeaderWriterFilter(org.springframework.security.web.header.HeaderWriterFilter)

Aggregations

HeaderWriterFilter (org.springframework.security.web.header.HeaderWriterFilter)2 HeaderWriter (org.springframework.security.web.header.HeaderWriter)1 ContentSecurityPolicyHeaderWriter (org.springframework.security.web.header.writers.ContentSecurityPolicyHeaderWriter)1 CrossOriginEmbedderPolicyHeaderWriter (org.springframework.security.web.header.writers.CrossOriginEmbedderPolicyHeaderWriter)1 CrossOriginOpenerPolicyHeaderWriter (org.springframework.security.web.header.writers.CrossOriginOpenerPolicyHeaderWriter)1 CrossOriginResourcePolicyHeaderWriter (org.springframework.security.web.header.writers.CrossOriginResourcePolicyHeaderWriter)1 FeaturePolicyHeaderWriter (org.springframework.security.web.header.writers.FeaturePolicyHeaderWriter)1 HpkpHeaderWriter (org.springframework.security.web.header.writers.HpkpHeaderWriter)1 HstsHeaderWriter (org.springframework.security.web.header.writers.HstsHeaderWriter)1 PermissionsPolicyHeaderWriter (org.springframework.security.web.header.writers.PermissionsPolicyHeaderWriter)1 ReferrerPolicyHeaderWriter (org.springframework.security.web.header.writers.ReferrerPolicyHeaderWriter)1 XContentTypeOptionsHeaderWriter (org.springframework.security.web.header.writers.XContentTypeOptionsHeaderWriter)1 XXssProtectionHeaderWriter (org.springframework.security.web.header.writers.XXssProtectionHeaderWriter)1 XFrameOptionsHeaderWriter (org.springframework.security.web.header.writers.frameoptions.XFrameOptionsHeaderWriter)1