Package org.apache.camel.support.jsse
Class BaseSSLContextParameters
- java.lang.Object
-
- org.apache.camel.support.jsse.JsseParameters
-
- org.apache.camel.support.jsse.BaseSSLContextParameters
-
- All Implemented Interfaces:
CamelContextAware
- Direct Known Subclasses:
SSLContextClientParameters,SSLContextParameters,SSLContextServerParameters
public abstract class BaseSSLContextParameters extends JsseParameters
Represents configuration options that can be applied in the client-side or server-side context depending on what they are applied to.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBaseSSLContextParameters.SSLContextDecoratorMakes a decoratedSSLContextappear as a normalSSLContext.protected static classBaseSSLContextParameters.SSLContextSpiDecoratorClass needed to provide decoration of an existingSSLContext.protected static classBaseSSLContextParameters.SSLServerSocketFactoryDecoratorA decorator that enables the application of configuration options to be applied to created sockets even after this factory has been created and turned over to client code.protected static classBaseSSLContextParameters.SSLSocketFactoryDecoratorA decorator that enables the application of configuration options to be applied to created sockets even after this factory has been created and turned over to client code.
-
Field Summary
Fields Modifier and Type Field Description protected static List<String>DEFAULT_CIPHER_SUITES_FILTER_EXCLUDEprotected static List<String>DEFAULT_CIPHER_SUITES_FILTER_INCLUDEprotected static List<String>DEFAULT_SECURE_SOCKET_PROTOCOLS_FILTER_EXCLUDEprotected static List<String>DEFAULT_SECURE_SOCKET_PROTOCOLS_FILTER_INCLUDE
-
Constructor Summary
Constructors Constructor Description BaseSSLContextParameters()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidconfigureSessionContext(SSLSessionContext sessionContext, String sessionTimeout)Configures aSSLSessionContext, client or server, with the supplied session timeout.protected voidconfigureSSLContext(SSLContext context)Configures the actualSSLContextitself with direct setter calls.protected Collection<String>filter(Collection<String> explicitValues, Collection<String> availableValues, Collection<String> currentValues, FilterParameters.Patterns patterns, FilterParameters.Patterns defaultPatterns, boolean applyDefaults)Filters the values inavailableValuesreturning only the values that are explicitly listed inexplicitValues(returns them regardless of if they appear inavailableValuesor not) ifexplicitValuesis notnullor according to the following rules: Match the include patterns inpatternsand don't match the exclude patterns inpatternsif patterns is notnull. Match the include patterns indefaultPatternsand don't match the exclude patterns indefaultPatternsif patterns isnullandapplyDefaultsis true. Are provided in currentValues if if patterns isnullandapplyDefaultsis false.protected Collection<String>filter(Collection<String> explicitValues, Collection<String> availableValues, List<Pattern> includePatterns, List<Pattern> excludePatterns)Filters the values inavailableValuesreturning only the values that are explicitly listed inexplicitValues(returns them regardless of if they appear inavailableValuesor not) ifexplicitValuesis notnullor as match the patterns inincludePatternsand do not match the patterns inexcludePatternsifexplicitValuesisnull.protected booleangetAllowPassthrough()Returns a flag indicating if default values should be applied in the event that no other property of the instance configures a particular aspect of the entity produced by the instance.CipherSuitesParametersgetCipherSuites()Returns the optional explicitly configured cipher suites for this configuration.FilterParametersgetCipherSuitesFilter()Returns the optional cipher suite filter for this configuration.protected FilterParametersgetDefaultCipherSuitesFilter()protected FilterParametersgetDefaultSecureSocketProcotolFilter()SecureSocketProtocolsParametersgetSecureSocketProtocols()Returns the explicitly configured secure socket protocol names for this configuration.FilterParametersgetSecureSocketProtocolsFilter()Returns the optional secure socket protocol filter for this configuration.StringgetSessionTimeout()Returns the optionalSSLSessionContexttimeout time forSSLSessions in seconds.protected List<SNIServerName>getSNIHostNames()protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLEngine>>getSSLEngineConfigurers(SSLContext context)Returns the list of configurers to apply to anSSLEnginein order to fully configure it in compliance with the provided configuration options.protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLServerSocketFactory>>getSSLServerSocketFactoryConfigurers(SSLContext context)Returns the list of configurers to apply to anSSLServerSocketFactoryin order to fully configure it in compliance with the provided configuration options.protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLServerSocket>>getSSLServerSocketFactorySSLServerSocketConfigurers(SSLContext context)Returns the list of configurers to apply to anSSLServerSocketin order to fully configure it in compliance with the provided configuration options.protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLSocketFactory>>getSSLSocketFactoryConfigurers(SSLContext context)Returns the list of configurers to apply to anSSLSocketFactoryin order to fully configure it in compliance with the provided configuration options.protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLSocket>>getSSLSocketFactorySSLSocketConfigurers(SSLContext context)Returns the list of configurers to apply to anSSLSocketin order to fully configure it in compliance with the provided configuration options.protected booleanmatchesOneOf(String value, List<Pattern> patterns)Returns true if and only if the value is matched by one or more of the supplied patterns.voidsetCipherSuites(CipherSuitesParameters cipherSuites)Sets the optional explicitly configured cipher suites for this configuration.voidsetCipherSuitesFilter(FilterParameters cipherSuitesFilter)Sets the optional cipher suite filter for this JSSE configuration.voidsetSecureSocketProtocols(SecureSocketProtocolsParameters secureSocketProtocols)Sets the explicitly configured secure socket protocol names for this configuration.voidsetSecureSocketProtocolsFilter(FilterParameters secureSocketProtocolsFilter)Sets the optional secure socket protocol filter for this JSSE configuration.voidsetSessionTimeout(String sessionTimeout)Sets the optionalSSLSessionContexttimeout time forSSLSessions in seconds.-
Methods inherited from class org.apache.camel.support.jsse.JsseParameters
getCamelContext, parsePropertyValue, parsePropertyValues, resolveResource, setCamelContext
-
-
-
-
Field Detail
-
DEFAULT_CIPHER_SUITES_FILTER_INCLUDE
protected static final List<String> DEFAULT_CIPHER_SUITES_FILTER_INCLUDE
-
DEFAULT_CIPHER_SUITES_FILTER_EXCLUDE
protected static final List<String> DEFAULT_CIPHER_SUITES_FILTER_EXCLUDE
-
DEFAULT_SECURE_SOCKET_PROTOCOLS_FILTER_INCLUDE
protected static final List<String> DEFAULT_SECURE_SOCKET_PROTOCOLS_FILTER_INCLUDE
-
-
Method Detail
-
getSNIHostNames
protected List<SNIServerName> getSNIHostNames()
-
getCipherSuites
public CipherSuitesParameters getCipherSuites()
Returns the optional explicitly configured cipher suites for this configuration. These options are used in the configuration ofSSLEngine,SSLSocketFactoryandSSLServerSocketFactorydepending on the context in which they are applied. These values override any filters supplied insetCipherSuitesFilter(FilterParameters)
-
setCipherSuites
public void setCipherSuites(CipherSuitesParameters cipherSuites)
Sets the optional explicitly configured cipher suites for this configuration. These options are used in the configuration ofSSLEngine,SSLSocketFactoryandSSLServerSocketFactorydepending on the context in which they are applied. These values override any filters supplied insetCipherSuitesFilter(FilterParameters)- Parameters:
cipherSuites- the suite configuration
-
getCipherSuitesFilter
public FilterParameters getCipherSuitesFilter()
Returns the optional cipher suite filter for this configuration. These options are used in the configuration ofSSLEngine,SSLSocketFactoryandSSLServerSocketFactorydepending on the context in which they are applied. These values are ignored ifsetCipherSuites(CipherSuitesParameters)is called with a nonnullargument.
-
setCipherSuitesFilter
public void setCipherSuitesFilter(FilterParameters cipherSuitesFilter)
Sets the optional cipher suite filter for this JSSE configuration. These options are used in the configuration ofSSLEngine,SSLSocketFactoryandSSLServerSocketFactorydepending on the context in which they are applied. These values are ignored ifsetCipherSuites(CipherSuitesParameters)is called with a nonnullargument.- Parameters:
cipherSuitesFilter- the filter configuration
-
getSecureSocketProtocols
public SecureSocketProtocolsParameters getSecureSocketProtocols()
Returns the explicitly configured secure socket protocol names for this configuration. These options are used in the configuration ofSSLEngine,SSLSocketFactoryandSSLServerSocketFactorydepending on the context in which they are applied. These values override any filters supplied insetSecureSocketProtocolsFilter(FilterParameters)
-
setSecureSocketProtocols
public void setSecureSocketProtocols(SecureSocketProtocolsParameters secureSocketProtocols)
Sets the explicitly configured secure socket protocol names for this configuration. These options are used in the configuration ofSSLEngine,SSLSocketFactoryandSSLServerSocketFactorydepending on the context in which they are applied. These values override any filters supplied insetSecureSocketProtocolsFilter(FilterParameters)
-
getSecureSocketProtocolsFilter
public FilterParameters getSecureSocketProtocolsFilter()
Returns the optional secure socket protocol filter for this configuration. These options are used in the configuration ofSSLEngine,SSLSocketFactoryandSSLServerSocketFactorydepending on the context in which they are applied. These values are ignored ifsetSecureSocketProtocols(SecureSocketProtocolsParameters)is called with a non-nullargument.
-
setSecureSocketProtocolsFilter
public void setSecureSocketProtocolsFilter(FilterParameters secureSocketProtocolsFilter)
Sets the optional secure socket protocol filter for this JSSE configuration. These options are used in the configuration ofSSLEngine,SSLSocketFactoryandSSLServerSocketFactorydepending on the context in which they are applied. These values are ignored ifsetSecureSocketProtocols(SecureSocketProtocolsParameters)is called with a non-nullargument.- Parameters:
secureSocketProtocolsFilter- the filter configuration
-
getSessionTimeout
public String getSessionTimeout()
Returns the optionalSSLSessionContexttimeout time forSSLSessions in seconds.
-
setSessionTimeout
public void setSessionTimeout(String sessionTimeout)
Sets the optionalSSLSessionContexttimeout time forSSLSessions in seconds.- Parameters:
sessionTimeout- the timeout value ornullto use the default
-
getAllowPassthrough
protected boolean getAllowPassthrough()
Returns a flag indicating if default values should be applied in the event that no other property of the instance configures a particular aspect of the entity produced by the instance. This flag is used to allow instances of this class to produce a configurer that simply passes through the current configuration of a configured entity when the instance of this class would otherwise only apply some default configuration.
-
configureSSLContext
protected void configureSSLContext(SSLContext context) throws GeneralSecurityException
Configures the actualSSLContextitself with direct setter calls. This method differs from configuration options that are handled by a configurer instance in that the options are part of the context itself and are not part of some factory or instance object returned by the context.- Parameters:
context- the context to configure- Throws:
GeneralSecurityException- if there is an error configuring the context
-
getDefaultCipherSuitesFilter
protected FilterParameters getDefaultCipherSuitesFilter()
-
getDefaultSecureSocketProcotolFilter
protected FilterParameters getDefaultSecureSocketProcotolFilter()
-
getSSLEngineConfigurers
protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLEngine>> getSSLEngineConfigurers(SSLContext context)
Returns the list of configurers to apply to anSSLEnginein order to fully configure it in compliance with the provided configuration options. The configurers are to be applied in the order in which they appear in the list.- Parameters:
context- the context that serves as the factory forSSLEngineinstances- Returns:
- the needed configurers
-
getSSLSocketFactoryConfigurers
protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLSocketFactory>> getSSLSocketFactoryConfigurers(SSLContext context)
Returns the list of configurers to apply to anSSLSocketFactoryin order to fully configure it in compliance with the provided configuration options. The configurers are to be applied in the order in which they appear in the list. It is preferred to usegetSSLSocketFactorySSLSocketConfigurers(SSLContext)instead of this method asSSLSocketFactorydoes not contain any configuration options that are non-proprietary.- Parameters:
context- the context that serves as the factory forSSLSocketFactoryinstances- Returns:
- the needed configurers
- See Also:
getSSLSocketFactorySSLSocketConfigurers(SSLContext)
-
getSSLServerSocketFactoryConfigurers
protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLServerSocketFactory>> getSSLServerSocketFactoryConfigurers(SSLContext context)
Returns the list of configurers to apply to anSSLServerSocketFactoryin order to fully configure it in compliance with the provided configuration options. The configurers are to be applied in the order in which they appear in the list. It is preferred to usegetSSLServerSocketFactorySSLServerSocketConfigurers(SSLContext)instead of this method asSSLServerSocketFactorydoes not contain any configuration options that are non-proprietary.- Parameters:
context- the context that serves as the factory forSSLServerSocketFactoryinstances- Returns:
- the needed configurers
- See Also:
getSSLServerSocketFactorySSLServerSocketConfigurers(SSLContext)
-
getSSLSocketFactorySSLSocketConfigurers
protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLSocket>> getSSLSocketFactorySSLSocketConfigurers(SSLContext context)
Returns the list of configurers to apply to anSSLSocketin order to fully configure it in compliance with the provided configuration options. These configurers are intended for sockets produced by aSSLSocketFactory, seegetSSLServerSocketFactorySSLServerSocketConfigurers(SSLContext)for configurers related to sockets produced by aSSLServerSocketFactory. The configurers are to be applied in the order in which they appear in the list.- Parameters:
context- the context that serves as the factory forSSLSocketFactoryinstances- Returns:
- the needed configurers
-
getSSLServerSocketFactorySSLServerSocketConfigurers
protected List<org.apache.camel.support.jsse.BaseSSLContextParameters.Configurer<SSLServerSocket>> getSSLServerSocketFactorySSLServerSocketConfigurers(SSLContext context)
Returns the list of configurers to apply to anSSLServerSocketin order to fully configure it in compliance with the provided configuration options. These configurers are intended for sockets produced by aSSLServerSocketFactory, seegetSSLSocketFactorySSLSocketConfigurers(SSLContext)for configurers related to sockets produced by aSSLSocketFactory. The configurers are to be applied in the order in which they appear in the list.- Parameters:
context- the context that serves as the factory forSSLServerSocketFactoryinstances- Returns:
- the needed configurers
-
configureSessionContext
protected void configureSessionContext(SSLSessionContext sessionContext, String sessionTimeout) throws GeneralSecurityException
Configures aSSLSessionContext, client or server, with the supplied session timeout.- Parameters:
sessionContext- the context to configuresessionTimeout- the timeout time period- Throws:
GeneralSecurityException- ifsessionContextisnull
-
filter
protected Collection<String> filter(Collection<String> explicitValues, Collection<String> availableValues, Collection<String> currentValues, FilterParameters.Patterns patterns, FilterParameters.Patterns defaultPatterns, boolean applyDefaults)
Filters the values inavailableValuesreturning only the values that are explicitly listed inexplicitValues(returns them regardless of if they appear inavailableValuesor not) ifexplicitValuesis notnullor according to the following rules:- Match the include patterns in
patternsand don't match the exclude patterns inpatternsif patterns is notnull. - Match the include patterns in
defaultPatternsand don't match the exclude patterns indefaultPatternsif patterns isnullandapplyDefaultsis true. - Are provided in currentValues if if patterns is
nullandapplyDefaultsis false.
- Parameters:
explicitValues- the optional explicit values to useavailableValues- the available values to filter frompatterns- the optional patterns to use whenexplicitValuesis not useddefaultPatterns- the required patterns to use whenexplicitValuesandpatternsare not usedapplyDefaults- flag indicating whether or not to apply defaults in the event that no explicit values and no patterns apply- Returns:
- the filtered values
- See Also:
filter(Collection, Collection, List, List)
- Match the include patterns in
-
filter
protected Collection<String> filter(Collection<String> explicitValues, Collection<String> availableValues, List<Pattern> includePatterns, List<Pattern> excludePatterns)
Filters the values inavailableValuesreturning only the values that are explicitly listed inexplicitValues(returns them regardless of if they appear inavailableValuesor not) ifexplicitValuesis notnullor as match the patterns inincludePatternsand do not match the patterns inexcludePatternsifexplicitValuesisnull.- Parameters:
explicitValues- the optional explicit values to useavailableValues- the available values to filter from ifexplicitValuesisnullincludePatterns- the patterns to use for inclusion filtering, required ifexplicitValuesisnullexcludePatterns- the patterns to use for exclusion filtering, required ifexplicitValuesisnull- Returns:
- the filtered values
-
-