Class PolicyInOrigin

java.lang.Object
org.htmlunit.csp.CspQueriesInOrigin
org.htmlunit.csp.PolicyInOrigin

public class PolicyInOrigin extends CspQueriesInOrigin
A convenience wrapper that pairs a Policy with its origin, providing simplified query methods that automatically supply the origin to the underlying policy checks.

Each allows* method is defined on CspQueriesInOrigin and delegates to Policy (CspQueries), filling in Optional.of(origin) for the origin parameter and Optional.empty() for unused parameters (nonce, integrity, redirects).

Author:
Ronald Brill, Rick Mitchell, Salvation Team
See Also:
  • Constructor Details

    • PolicyInOrigin

      public PolicyInOrigin(Policy policy, URLWithScheme origin)
      Ctor.
      Parameters:
      policy - the Content Security Policy to query against
      origin - the origin of the protected resource
  • Method Details

    • getPolicy

      public Policy getPolicy()
      Returns the underlying Policy.
      Returns:
      the policy associated with this origin-bound wrapper