Package org.wildfly.security.ssl
Interface SSLContextSelector
-
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface public interface SSLContextSelector
A selector which chooses an SSL context based on connection information.- Author:
- David M. Lloyd
-
-
Field Summary
Fields Modifier and Type Field Description static SSLContextSelector
NULL_SELECTOR
A selector which always returnsnull
(no match).
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description static SSLContextSelector
aggregate(SSLContextSelector... selectors)
Create an aggregate selector which executes each given selector in order until a match is found.static SSLContextSelector
aggregate(SSLContextSelector selector1, SSLContextSelector selector2)
Create an aggregate selector which executes each given selector in order until a match is found.static SSLContextSelector
constantSelector(SSLContext context)
Create a selector which always returns the same context.SSLContext
selectContext(SSLConnectionInformation connectionInformation)
Select the SSL context which corresponds to the given connection information.static SSLContextSelector
sniMatcherSelector(SNIMatcher matcher, SSLContext context)
Create a selector which returns the given SSL context if the given SNI matcher matches.
-
-
-
Field Detail
-
NULL_SELECTOR
static final SSLContextSelector NULL_SELECTOR
A selector which always returnsnull
(no match).
-
-
Method Detail
-
selectContext
SSLContext selectContext(SSLConnectionInformation connectionInformation)
Select the SSL context which corresponds to the given connection information. The selector returns the SSL context that should be used for this connection, ornull
if no SSL contexts match, in which case a fallback selector may be used, or a default SSL context selected. If no selectors match an SSL context, the connection is refused.- Parameters:
connectionInformation
- information about the in-progress connection- Returns:
- the SSL context to use, or
null
if the connection is not acceptable to this selector
-
aggregate
static SSLContextSelector aggregate(SSLContextSelector selector1, SSLContextSelector selector2)
Create an aggregate selector which executes each given selector in order until a match is found.- Parameters:
selector1
- the first selector to testselector2
- the second selector to test- Returns:
- the matched selector
-
aggregate
static SSLContextSelector aggregate(SSLContextSelector... selectors)
Create an aggregate selector which executes each given selector in order until a match is found.- Parameters:
selectors
- the selectors to test- Returns:
- the matched selector
-
sniMatcherSelector
static SSLContextSelector sniMatcherSelector(SNIMatcher matcher, SSLContext context)
Create a selector which returns the given SSL context if the given SNI matcher matches.- Parameters:
matcher
- the SNI matcher (must not benull
)context
- the SSL context to select (must not benull
)- Returns:
- the context if the name matches, otherwise
null
- See Also:
SNIHostName.createSNIMatcher(String)
,SSLUtils.createHostNameStringPredicateSNIMatcher(java.util.function.Predicate)
,SSLUtils.createHostNamePredicateSNIMatcher(java.util.function.Predicate)
,SSLUtils.createHostNameStringSNIMatcher(String)
,SSLUtils.createHostNameSuffixSNIMatcher(String)
-
constantSelector
static SSLContextSelector constantSelector(SSLContext context)
Create a selector which always returns the same context.- Parameters:
context
- the context to return- Returns:
- the selector which always returns
context
-
-