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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionHostPortValidatorCustomizer(Set<Integer> validPorts) HOst Port Validator Customer constructor with additional valid ports from application properties -
Method Summary
Modifier and TypeMethodDescriptionorg.eclipse.jetty.server.Requestcustomize(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.private intgetLocalSocketAddressPort(org.eclipse.jetty.server.Request request)
-
Field Details
-
MISDIRECTED_REQUEST_REASON
- See Also:
-
PORT_NOT_SPECIFIED
private static final int PORT_NOT_SPECIFIED- See Also:
-
validPorts
-
-
Constructor Details
-
HostPortValidatorCustomizer
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:
customizein interfaceorg.eclipse.jetty.server.HttpConfiguration.Customizer- Parameters:
request- HTTP Request to be evaluatedresponseHeaders- HTTP Response headers- Returns:
- Valid HTTP Request
-
getLocalSocketAddressPort
private int getLocalSocketAddressPort(org.eclipse.jetty.server.Request request)
-