Package org.kiwiproject.config
Class SecureEndpointsConfiguration
java.lang.Object
org.kiwiproject.config.SSLContextConfiguration
org.kiwiproject.config.SecureEndpointsConfiguration
- All Implemented Interfaces:
KeyAndTrustStoreConfigProvider,TrustStoreConfigProvider
Configuration for secure REST endpoints, including the configuration from an
SSLContextConfiguration
as well as adding a collection of EndpointConfiguration instances. Supports programmatic creation
using a builder. Also supports construction from external configuration, e.g. from a YAML configuration file, using
the no-args constructor and setter methods.
As this is a configuration class that supports population from external configuration, it is mutable.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreate instance with empty collection of endpoints. -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns true if all of the endpoints in this configuration are secure.booleanReturns true if any of the endpoints in this configuration is secure.builder()Return a new builder instance.getEndpointByPathEnding(String pathEnding) Finds theEndpointConfigurationwith a path ending with the givenpathEnding, throwing an exception if not found.getEndpointByPathEndingOrEmpty(String pathEnding) Finds theEndpointConfigurationwith a path ending with the givenpathEnding, returning an empty Optional if not found.getEndpointByTag(String tag) Finds theEndpointConfigurationwith the given tag, throwing an exception if not found.Finds theEndpointConfigurationwith the given tag, returning an empty Optional if not found.The endpoints in this configuration.booleanisSecure()Returns true if any of the endpoints in this configuration is secure.voidsetEndpoints(List<EndpointConfiguration> endpoints) The endpoints in this configuration.Methods inherited from class org.kiwiproject.config.SSLContextConfiguration
getKeyStorePassword, getKeyStorePath, getKeyStoreType, getProtocol, getTrustStorePassword, getTrustStorePath, getTrustStoreType, isDisableSniHostCheck, isVerifyHostname, setDisableSniHostCheck, setKeyStorePassword, setKeyStorePath, setKeyStoreType, setProtocol, setTrustStorePassword, setTrustStorePath, setTrustStoreType, setVerifyHostname, toSimpleSSLContextFactory, toSSLContext, toTlsContextConfigurationMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.kiwiproject.security.TrustStoreConfigProvider
toSslSocketFactory
-
Constructor Details
-
SecureEndpointsConfiguration
public SecureEndpointsConfiguration()Create instance with empty collection of endpoints.
-
-
Method Details
-
builder
Return a new builder instance.- Returns:
- the builder instance
-
isSecure
public boolean isSecure()Returns true if any of the endpoints in this configuration is secure.Alias for
anyEndpointSecure().- Returns:
- true if any endpoint is secure
-
anyEndpointSecure
public boolean anyEndpointSecure()Returns true if any of the endpoints in this configuration is secure.- Returns:
trueif any of endpoint is secure:falseotherwise
-
allEndpointsSecure
public boolean allEndpointsSecure()Returns true if all of the endpoints in this configuration are secure.- Returns:
trueif all endpoints are secure:falseotherwise
-
getEndpointByTag
Finds theEndpointConfigurationwith the given tag, throwing an exception if not found.- Parameters:
tag- the tag to search for- Returns:
- the EndpointConfiguration with the given tag
- Throws:
IllegalStateException- if there is no such endpoint
-
getEndpointByTagOrEmpty
Finds theEndpointConfigurationwith the given tag, returning an empty Optional if not found.- Parameters:
tag- the tag to search for- Returns:
- an
Optionalthat may or may not contain an endpoint
-
getEndpointByPathEnding
Finds theEndpointConfigurationwith a path ending with the givenpathEnding, throwing an exception if not found.- Parameters:
pathEnding- the end of the path to look for in each endpoint- Returns:
- the EndpointConfiguration with the given path ending
- Throws:
IllegalStateException- if there is no such endpoint
-
getEndpointByPathEndingOrEmpty
Finds theEndpointConfigurationwith a path ending with the givenpathEnding, returning an empty Optional if not found.- Parameters:
pathEnding- the end of the path to look for in each endpoint- Returns:
- an
Optionalthat may or may not contain an endpoint
-
getEndpoints
The endpoints in this configuration. -
setEndpoints
The endpoints in this configuration.
-