- All Implemented Interfaces:
HttpConfiguration.Customizer
Customizer that extracts the attribute from an SSLContext
and sets them on the request with Attributes.setAttribute(String, Object)
according to Servlet Specification Requirements.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classprotected classstatic final recordSimple bundle of data that is cached in the SSLSession. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe request attribute name to use to obtain the cipher suite name.static final StringThe default value of the request attribute name to use to obtain theSSLSessionobject.static final StringThe default value of the request attribute name to use to obtain theSecureRequestCustomizer.SslSessionDataobject.static final StringThe request attribute name to use to obtain the key size.static final StringThe request attribute name to use to obtain the peer certificate chain as an array ofX509Certificateobjects.static final StringThe request attribute name to use to obtain theSSLSession.getId().static final StringThe request attribute name to use to obtain the local certificate as anX509object. -
Constructor Summary
ConstructorsConstructorDescriptionSecureRequestCustomizer(boolean sniHostCheck) SecureRequestCustomizer(boolean sniRequired, boolean sniHostCheck, long stsMaxAgeSeconds, boolean stsIncludeSubdomains) SecureRequestCustomizer(boolean sniHostCheck, long stsMaxAgeSeconds, boolean stsIncludeSubdomains) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckSni(Request request, SSLSession session) longbooleanbooleanbooleanprotected RequestnewSecureRequest(Request request, SSLEngine sslEngine) voidsetSniHostCheck(boolean sniHostCheck) voidsetSniRequired(boolean sniRequired) voidsetSslSessionAttribute(String attribute) voidsetStsIncludeSubDomains(boolean stsIncludeSubDomains) voidsetStsMaxAge(long stsMaxAgeSeconds) Sets the Strict-Transport-Security max age in seconds.voidsetStsMaxAge(long period, TimeUnit units) Sets the Strict-Transport-Security max age in the given time unit.toString()
-
Field Details
-
CIPHER_SUITE_ATTRIBUTE
The request attribute name to use to obtain the cipher suite name.
- See Also:
-
KEY_SIZE_ATTRIBUTE
The request attribute name to use to obtain the key size.
- See Also:
-
SSL_SESSION_ID_ATTRIBUTE
The request attribute name to use to obtain the
SSLSession.getId().- See Also:
-
PEER_CERTIFICATES_ATTRIBUTE
The request attribute name to use to obtain the peer certificate chain as an array of
X509Certificateobjects.- See Also:
-
X509_ATTRIBUTE
The request attribute name to use to obtain the local certificate as an
X509object.- See Also:
-
DEFAULT_SSL_SESSION_ATTRIBUTE
The default value of the request attribute name to use to obtain the
SSLSessionobject.- See Also:
-
DEFAULT_SSL_SESSION_DATA_ATTRIBUTE
The default value of the request attribute name to use to obtain the
SecureRequestCustomizer.SslSessionDataobject.- See Also:
-
-
Constructor Details
-
SecureRequestCustomizer
public SecureRequestCustomizer() -
SecureRequestCustomizer
public SecureRequestCustomizer(@Name("sniHostCheck") boolean sniHostCheck) -
SecureRequestCustomizer
public SecureRequestCustomizer(@Name("sniHostCheck") boolean sniHostCheck, @Name("stsMaxAgeSeconds") long stsMaxAgeSeconds, @Name("stsIncludeSubdomains") boolean stsIncludeSubdomains) - Parameters:
sniHostCheck- True if the SNI Host name must match.stsMaxAgeSeconds- The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.stsIncludeSubdomains- If true, a include subdomain property is sent with any Strict-Transport-Security header
-
SecureRequestCustomizer
public SecureRequestCustomizer(@Name("sniRequired") boolean sniRequired, @Name("sniHostCheck") boolean sniHostCheck, @Name("stsMaxAgeSeconds") long stsMaxAgeSeconds, @Name("stsIncludeSubdomains") boolean stsIncludeSubdomains) - Parameters:
sniRequired- True if a SNI certificate is required.sniHostCheck- True if the SNI Host name must match.stsMaxAgeSeconds- The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.stsIncludeSubdomains- If true, a include subdomain property is sent with any Strict-Transport-Security header
-
-
Method Details
-
isSniHostCheck
public boolean isSniHostCheck()- Returns:
- True if the SNI Host name must match when there is an SNI certificate.
-
setSniHostCheck
public void setSniHostCheck(boolean sniHostCheck) - Parameters:
sniHostCheck- True if the SNI Host name must match when there is an SNI certificate.
-
isSniRequired
public boolean isSniRequired()- Returns:
- True if SNI is required, else requests will be rejected with 400 response.
- See Also:
-
setSniRequired
public void setSniRequired(boolean sniRequired) - Parameters:
sniRequired- True if SNI is required, else requests will be rejected with 400 response.- See Also:
-
getStsMaxAge
public long getStsMaxAge()- Returns:
- The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.
-
setStsMaxAge
public void setStsMaxAge(long stsMaxAgeSeconds) Sets the Strict-Transport-Security max age in seconds.- Parameters:
stsMaxAgeSeconds- the max age in seconds for the Strict-Transport-Security response header. If less than zero then no Strict-Transport-Security response header is set.
-
setStsMaxAge
Sets the Strict-Transport-Security max age in the given time unit.- Parameters:
period- The max age valueunits- TheTimeUnitof the max age
-
isStsIncludeSubDomains
public boolean isStsIncludeSubDomains()- Returns:
- whether the
includeSubdomainsattribute is sent with the Strict-Transport-Security response header
-
setStsIncludeSubDomains
public void setStsIncludeSubDomains(boolean stsIncludeSubDomains) - Parameters:
stsIncludeSubDomains- whether theincludeSubdomainsattribute is sent with the Strict-Transport-Security response header
-
customize
public Request customize(Request request, org.eclipse.jetty.http.HttpFields.Mutable responseHeaders) - Specified by:
customizein interfaceHttpConfiguration.Customizer
-
newSecureRequest
-
setSslSessionAttribute
-
getSslSessionAttribute
-
getSslSessionDataAttribute
- Returns:
getSslSessionAttribute()+ "Data"
-
checkSni
-
toString
-