Search in sources :

Example 1 with PermissionsPolicyHeaderWriter

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

the class HeadersConfigurer method permissionsPolicy.

/**
 * Allows configuration for
 * <a href="https://w3c.github.io/webappsec-permissions-policy/"> Permissions
 * Policy</a>.
 * <p>
 * Calling this method automatically enables (includes) the {@code Permissions-Policy}
 * header in the response using the supplied policy directive(s).
 * <p>
 * Configuration is provided to the {@link PermissionsPolicyHeaderWriter} which is
 * responsible for writing the header.
 * @return the {@link PermissionsPolicyConfig} for additional configuration
 * @throws IllegalArgumentException if policyDirectives is {@code null} or empty
 * @since 5.5
 * @see PermissionsPolicyHeaderWriter
 */
public PermissionsPolicyConfig permissionsPolicy(Customizer<PermissionsPolicyConfig> permissionsPolicyCustomizer) {
    this.permissionsPolicy.writer = new PermissionsPolicyHeaderWriter();
    permissionsPolicyCustomizer.customize(this.permissionsPolicy);
    return this.permissionsPolicy;
}
Also used : PermissionsPolicyHeaderWriter(org.springframework.security.web.header.writers.PermissionsPolicyHeaderWriter)

Aggregations

PermissionsPolicyHeaderWriter (org.springframework.security.web.header.writers.PermissionsPolicyHeaderWriter)1