Class HostPortValidatorCustomizer

java.lang.Object
org.apache.nifi.web.server.connector.HostPortValidatorCustomizer
All Implemented Interfaces:
org.eclipse.jetty.server.HttpConfiguration.Customizer

public class HostPortValidatorCustomizer extends Object implements org.eclipse.jetty.server.HttpConfiguration.Customizer
Jetty Request Customizer implementing validation of port included in HTTP/1.1 Host Header or HTTP/2 authority header
  • Field Details

  • Constructor Details

    • HostPortValidatorCustomizer

      public HostPortValidatorCustomizer(Set<Integer> validPorts)
      HOst Port Validator Customer constructor with additional valid ports from application properties
      Parameters:
      validPorts - Valid Ports on HTTPS requests
  • Method Details

    • customize

      public org.eclipse.jetty.server.Request customize(org.eclipse.jetty.server.Request request, org.eclipse.jetty.http.HttpFields.Mutable responseHeaders)
      Validate requested port against connected port and valid ports for secure HTTPS requests. The port is not specified when the header includes only the domain name as described in RFC 9110 Section 7.2. The port must match the local socket address port or a configured valid port number.
      Specified by:
      customize in interface org.eclipse.jetty.server.HttpConfiguration.Customizer
      Parameters:
      request - HTTP Request to be evaluated
      responseHeaders - HTTP Response headers
      Returns:
      Valid HTTP Request
    • getLocalSocketAddressPort

      private int getLocalSocketAddressPort(org.eclipse.jetty.server.Request request)