Top Description Inners Fields Constructors Methods
org.eclipse.jetty.server

public Class SecureRequestCustomizer

extends Object
implements Customizer
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.server.HttpConfiguration.Customizer
Imports
java.security.cert.Certificate, .X509Certificate, java.util.Set, java.util.concurrent.TimeUnit, javax.net.ssl.SSLContext, .SSLSession, org.eclipse.jetty.http.BadMessageException, .HttpField, .HttpFields, .HttpHeader, .PreEncodedHttpField, org.eclipse.jetty.io.EndPoint, org.eclipse.jetty.util.annotation.Name, org.eclipse.jetty.util.ssl.SslContextFactory, .X509, org.slf4j.Logger, .LoggerFactory

Customizer that extracts the attribute of an SSLContext and makes them available via Request#getAttribute(String) using the names:

See Also
EndPoint.SslSessionData

Nested and Inner Type Summary

Modifier and TypeClass and Description
protected static class
protected class

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private HttpField
private boolean
private long
private static final Logger
public static final String

Constructor Summary

AccessConstructor and Description
public
public
SecureRequestCustomizer(boolean sniHostCheck)

public
SecureRequestCustomizer(boolean
True if the SNI Host name must match.
sniHostCheck
,
long
The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.
stsMaxAgeSeconds
,
boolean
If true, a include subdomain property is sent with any Strict-Transport-Security header
stsIncludeSubdomains
)

public
SecureRequestCustomizer(boolean
True if a SNI certificate is required.
sniRequired
,
boolean
True if the SNI Host name must match.
sniHostCheck
,
long
The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.
stsMaxAgeSeconds
,
boolean
If true, a include subdomain property is sent with any Strict-Transport-Security header
stsIncludeSubdomains
)

Method Summary

Modifier and TypeMethod and Description
protected void
checkSni(Request request, SSLSession session)

public Request
private void
public long

Returns:

The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.
getStsMaxAge
()

private X509
public boolean

Returns:

True if the SNI Host name must match when there is an SNI certificate.
isSniHostCheck
()

public boolean

Returns:

True if SNI is required, else requests will be rejected with 400 response.
isSniRequired
()

public boolean

Returns:

whether the includeSubdomains attribute is sent with the Strict-Transport-Security response header
isStsIncludeSubDomains
()

protected Request
public void
setSniHostCheck(boolean
True if the SNI Host name must match when there is an SNI certificate.
sniHostCheck
)

public void
setSniRequired(boolean
True if SNI is required, else requests will be rejected with 400 response.
sniRequired
)

public void
setStsIncludeSubDomains(boolean
whether the includeSubdomains attribute is sent with the Strict-Transport-Security response header
stsIncludeSubDomains
)

Set whether the includeSubdomains attribute is sent with the Strict-Transport-Security response header.

public void
setStsMaxAge(long
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.
stsMaxAgeSeconds
)

Sets the Strict-Transport-Security max age in seconds.

public void
setStsMaxAge(long
The max age value
period
,
TimeUnit
The TimeUnit of the max age
units
)

Sets the Strict-Transport-Security max age in the given time unit.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

_sniHostCheckback to summary
private boolean _sniHostCheck
_sniRequiredback to summary
private boolean _sniRequired
_stsFieldback to summary
private HttpField _stsField
_stsIncludeSubDomainsback to summary
private boolean _stsIncludeSubDomains
_stsMaxAgeback to summary
private long _stsMaxAge
LOGback to summary
private static final Logger LOG
X509_ATTRIBUTEback to summary
public static final String X509_ATTRIBUTE

Constructor Detail

SecureRequestCustomizerback to summary
public SecureRequestCustomizer()
SecureRequestCustomizerback to summary
public SecureRequestCustomizer(boolean sniHostCheck)
SecureRequestCustomizerback to summary
public SecureRequestCustomizer(boolean sniHostCheck, long stsMaxAgeSeconds, boolean stsIncludeSubdomains)
Parameters
sniHostCheck:boolean

True if the SNI Host name must match.

stsMaxAgeSeconds:long

The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.

stsIncludeSubdomains:boolean

If true, a include subdomain property is sent with any Strict-Transport-Security header

SecureRequestCustomizerback to summary
public SecureRequestCustomizer(boolean sniRequired, boolean sniHostCheck, long stsMaxAgeSeconds, boolean stsIncludeSubdomains)
Parameters
sniRequired:boolean

True if a SNI certificate is required.

sniHostCheck:boolean

True if the SNI Host name must match.

stsMaxAgeSeconds:long

The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.

stsIncludeSubdomains:boolean

If true, a include subdomain property is sent with any Strict-Transport-Security header

Method Detail

checkSniback to summary
protected void checkSni(Request request, SSLSession session)
customizeback to summary
public Request customize(Request request, HttpFields.Mutable responseHeaders)

Implements org.eclipse.jetty.server.HttpConfiguration.Customizer.customize.

Annotations
@Override
formatSTSback to summary
private void formatSTS()
getStsMaxAgeback to summary
public long getStsMaxAge()
Returns:long

The max age in seconds for a Strict-Transport-Security response header. If set less than zero then no header is sent.

getX509back to summary
private X509 getX509(SSLSession session)
isSniHostCheckback to summary
public boolean isSniHostCheck()
Returns:boolean

True if the SNI Host name must match when there is an SNI certificate.

isSniRequiredback to summary
public boolean isSniRequired()
Returns:boolean

True if SNI is required, else requests will be rejected with 400 response.

See Also
SslContextFactory.Server#isSniRequired()
isStsIncludeSubDomainsback to summary
public boolean isStsIncludeSubDomains()
Returns:boolean

whether the includeSubdomains attribute is sent with the Strict-Transport-Security response header

newSecureRequestback to summary
protected Request newSecureRequest(Request request, EndPoint.SslSessionData sslSessionData)
setSniHostCheckback to summary
public void setSniHostCheck(boolean sniHostCheck)
Parameters
sniHostCheck:boolean

True if the SNI Host name must match when there is an SNI certificate.

setSniRequiredback to summary
public void setSniRequired(boolean sniRequired)
Parameters
sniRequired:boolean

True if SNI is required, else requests will be rejected with 400 response.

See Also
SslContextFactory.Server#setSniRequired(boolean)
setStsIncludeSubDomainsback to summary
public void setStsIncludeSubDomains(boolean stsIncludeSubDomains)

Set whether the includeSubdomains attribute is sent with the Strict-Transport-Security response header.

Parameters
stsIncludeSubDomains:boolean

whether the includeSubdomains attribute is sent with the Strict-Transport-Security response header

setStsMaxAgeback to summary
public void setStsMaxAge(long stsMaxAgeSeconds)

Sets the Strict-Transport-Security max age in seconds.

Parameters
stsMaxAgeSeconds:long

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.

setStsMaxAgeback to summary
public void setStsMaxAge(long period, TimeUnit units)

Sets the Strict-Transport-Security max age in the given time unit.

Parameters
period:long

The max age value

units:TimeUnit

The TimeUnit of the max age

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
org.eclipse.jetty.server back to summary

protected Class SecureRequestCustomizer.SecureRequest

extends Wrapper
Class Inheritance

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public boolean
Inherited from org.eclipse.jetty.server.Request.Wrapper:
addFailureListeneraddHttpStreamWrapperaddIdleTimeoutListenerasAttributeMapclearAttributesconsumeAvailabledemandfailgetAttributegetAttributeNameSetgetBeginNanoTimegetComponentsgetConnectionMetaDatagetContextgetHeadersgetHeadersNanoTimegetHttpURIgetIdgetLengthgetMethodgetSessiongetTrailersgetTunnelSupportgetWrappedpushreadremoveAttributesetAttribute

Constructor Detail

SecureRequestback to summary
public SecureRequest(Request wrapped)

Method Detail

isSecureback to summary
public boolean isSecure()

Overrides org.eclipse.jetty.server.Request.Wrapper.isSecure.

Implements org.eclipse.jetty.server.Request.isSecure.

Annotations
@Override
org.eclipse.jetty.server back to summary

protected Class SecureRequestCustomizer.SecureRequestWithSslSessionData

extends AttributesWrapper
Class Inheritance

Field Summary

Modifier and TypeField and Description
private static final Set<String>

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public boolean
Inherited from org.eclipse.jetty.server.Request.AttributesWrapper:
asAttributeMapclearAttributesgetAttributegetAttributeNameSetremoveAttributesetAttribute

Field Detail

ATTRIBUTESback to summary
private static final Set<String> ATTRIBUTES

Constructor Detail

SecureRequestWithSslSessionDataback to summary
protected SecureRequestWithSslSessionData(Request request, EndPoint.SslSessionData sslSessionData)

Method Detail

isSecureback to summary
public boolean isSecure()

Overrides org.eclipse.jetty.server.Request.Wrapper.isSecure.

Implements org.eclipse.jetty.server.Request.isSecure.

Annotations
@Override