Package org.eclipse.jetty.server
Class SecureRequestCustomizer
- java.lang.Object
-
- org.eclipse.jetty.server.SecureRequestCustomizer
-
- All Implemented Interfaces:
HttpConfiguration.Customizer
public class SecureRequestCustomizer extends java.lang.Object implements HttpConfiguration.Customizer
Customizer that extracts the attribute from an
SSLContextand sets them on the request withServletRequest.setAttribute(String, Object)according to Servlet Specification Requirements.
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringJAVAX_SERVLET_REQUEST_CIPHER_SUITEstatic java.lang.StringJAVAX_SERVLET_REQUEST_KEY_SIZEstatic java.lang.StringJAVAX_SERVLET_REQUEST_SSL_SESSION_IDstatic java.lang.StringJAVAX_SERVLET_REQUEST_X_509_CERTIFICATE
-
Constructor Summary
Constructors Constructor Description SecureRequestCustomizer()SecureRequestCustomizer(boolean sniHostCheck)SecureRequestCustomizer(boolean sniRequired, boolean sniHostCheck, long stsMaxAgeSeconds, boolean stsIncludeSubdomains)SecureRequestCustomizer(boolean sniHostCheck, long stsMaxAgeSeconds, boolean stsIncludeSubdomains)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcustomize(Connector connector, HttpConfiguration channelConfig, Request request)java.lang.StringgetSslSessionAttribute()longgetStsMaxAge()booleanisSniHostCheck()booleanisSniRequired()booleanisStsIncludeSubDomains()voidsetSniHostCheck(boolean sniHostCheck)voidsetSniRequired(boolean sniRequired)voidsetSslSessionAttribute(java.lang.String attribute)voidsetStsIncludeSubDomains(boolean stsIncludeSubDomains)voidsetStsMaxAge(long stsMaxAgeSeconds)Set the Strict-Transport-Security max age.voidsetStsMaxAge(long period, java.util.concurrent.TimeUnit units)Convenience method to callsetStsMaxAge(long)java.lang.StringtoString()
-
-
-
Field Detail
-
JAVAX_SERVLET_REQUEST_X_509_CERTIFICATE
public static final java.lang.String JAVAX_SERVLET_REQUEST_X_509_CERTIFICATE
- See Also:
- Constant Field Values
-
JAVAX_SERVLET_REQUEST_CIPHER_SUITE
public static final java.lang.String JAVAX_SERVLET_REQUEST_CIPHER_SUITE
- See Also:
- Constant Field Values
-
JAVAX_SERVLET_REQUEST_KEY_SIZE
public static final java.lang.String JAVAX_SERVLET_REQUEST_KEY_SIZE
- See Also:
- Constant Field Values
-
JAVAX_SERVLET_REQUEST_SSL_SESSION_ID
public static final java.lang.String JAVAX_SERVLET_REQUEST_SSL_SESSION_ID
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
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:
SslContextFactory.Server.isSniRequired()
-
setSniRequired
public void setSniRequired(boolean sniRequired)
- Parameters:
sniRequired- True if SNI is required, else requests will be rejected with 400 response.- See Also:
SslContextFactory.Server.setSniRequired(boolean)
-
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)
Set the Strict-Transport-Security max age.- Parameters:
stsMaxAgeSeconds- 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 period, java.util.concurrent.TimeUnit units)Convenience method to callsetStsMaxAge(long)- Parameters:
period- The period in unitsunits- TheTimeUnitof the period
-
isStsIncludeSubDomains
public boolean isStsIncludeSubDomains()
- Returns:
- true if a include subdomain property is sent with any Strict-Transport-Security header
-
setStsIncludeSubDomains
public void setStsIncludeSubDomains(boolean stsIncludeSubDomains)
- Parameters:
stsIncludeSubDomains- If true, a include subdomain property is sent with any Strict-Transport-Security header
-
customize
public void customize(Connector connector, HttpConfiguration channelConfig, Request request)
- Specified by:
customizein interfaceHttpConfiguration.Customizer
-
setSslSessionAttribute
public void setSslSessionAttribute(java.lang.String attribute)
-
getSslSessionAttribute
public java.lang.String getSslSessionAttribute()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-