Package io.micronaut.http.ssl
Class SslConfiguration
java.lang.Object
io.micronaut.http.ssl.SslConfiguration
- All Implemented Interfaces:
Toggleable
- Direct Known Subclasses:
AbstractClientSslConfiguration,DefaultSslConfiguration,ServerSslConfiguration
Configuration properties for SSL handling.
- Since:
- 1.0
- Author:
- James Kleeh
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConfiguration properties for SSL key.static classConfiguration properties for SSL key store.static classConfiguration properties for SSL trust store. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanstatic final booleanThe default build self signed value.static final booleanThe default enable value.static final intThe default port value.static final StringThe default protocol.protected intstatic final StringThe prefix used to resolve this configuration. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleangetKey()intgetPort()booleanbooleanWhether an OpenSSL-backed TLS implementation should be preferred if it's on the classpath.protected final voidreadExisting(SslConfiguration defaultSslConfiguration, SslConfiguration.KeyConfiguration defaultKeyConfiguration, SslConfiguration.KeyStoreConfiguration defaultKeyStoreConfiguration, SslConfiguration.TrustStoreConfiguration defaultTrustStoreConfiguration) Reads an existing config.voidsetBuildSelfSigned(boolean buildSelfSigned) Deprecated.voidsetCiphers(String[] ciphers) Sets the ciphers to use.voidsetClientAuthentication(ClientAuthentication clientAuthentication) Sets the client authentication mode.voidsetEnabled(boolean enabled) Whether SSL is enabled.voidsetHandshakeTimeout(@NonNull Duration handshakeTimeout) voidSets the key configuration.voidSets the keystore configuration.voidsetPort(int port) Deprecated.Please usemicronaut.server.ssl.portinstead (ServerSslConfiguration.setPort(int)).voidsetPreferOpenssl(boolean preferOpenssl) Whether an OpenSSL-backed TLS implementation should be preferred if it's on the classpath.voidsetProtocol(String protocol) Sets the protocol to use.voidsetProtocols(String[] protocols) Sets the protocols to use.voidSets the trust store configuration.
-
Field Details
-
PREFIX
The prefix used to resolve this configuration.- See Also:
-
DEFAULT_ENABLED
public static final boolean DEFAULT_ENABLEDThe default enable value.- See Also:
-
DEFAULT_PORT
public static final int DEFAULT_PORTThe default port value.- See Also:
-
DEFAULT_BUILDSELFSIGNED
public static final boolean DEFAULT_BUILDSELFSIGNEDThe default build self signed value.- See Also:
-
DEFAULT_PROTOCOL
The default protocol.- See Also:
-
port
protected int port -
buildSelfSigned
protected boolean buildSelfSigned
-
-
Constructor Details
-
SslConfiguration
public SslConfiguration()
-
-
Method Details
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceToggleable- Returns:
- Whether SSL is enabled.
-
setEnabled
public void setEnabled(boolean enabled) Whether SSL is enabled. Default value (false).- Parameters:
enabled- True if SSL is enabled
-
getPort
public int getPort()- Returns:
- The default SSL port
-
buildSelfSigned
public boolean buildSelfSigned()- Returns:
- Whether to build a self-signed certificate
-
getClientAuthentication
- Returns:
- The type of client authentication
-
getCiphers
- Returns:
- Which SSL ciphers to use
-
getProtocols
- Returns:
- Which protocols to use
-
getKey
- Returns:
- The configuration for the key
-
getKeyStore
- Returns:
- The configuration for the key store
-
getTrustStore
- Returns:
- The configuration for the trust store
-
getProtocol
- Returns:
- The protocol to use
-
getHandshakeTimeout
- Returns:
- The timeout for the SSL handshake
-
setPort
Deprecated.Please usemicronaut.server.ssl.portinstead (ServerSslConfiguration.setPort(int)).Sets the SSL port. Default value (8443).- Parameters:
port- The port
-
setBuildSelfSigned
Deprecated.Please usemicronaut.server.ssl.build-self-signedinstead (buildSelfSigned()).Sets whether to build a self-signed certificate. Default value (false).- Parameters:
buildSelfSigned- True if a certificate should be built
-
setKey
Sets the key configuration.- Parameters:
key- The key configuration
-
setKeyStore
Sets the keystore configuration.- Parameters:
keyStore- The keystore configuration
-
setTrustStore
Sets the trust store configuration.- Parameters:
trustStore- The trust store.
-
setClientAuthentication
Sets the client authentication mode.- Parameters:
clientAuthentication- The client authentication mode
-
setCiphers
Sets the ciphers to use.- Parameters:
ciphers- The ciphers
-
setProtocols
Sets the protocols to use.- Parameters:
protocols- The protocols
-
setProtocol
Sets the protocol to use. Default value ("TLS").- Parameters:
protocol- The protocol
-
setHandshakeTimeout
- Parameters:
handshakeTimeout- The timeout for the SSL handshake
-
isPreferOpenssl
public boolean isPreferOpenssl()Whether an OpenSSL-backed TLS implementation should be preferred if it's on the classpath.trueby default.- Returns:
- Whether OpenSSL should be preferred
-
setPreferOpenssl
public void setPreferOpenssl(boolean preferOpenssl) Whether an OpenSSL-backed TLS implementation should be preferred if it's on the classpath.trueby default.- Parameters:
preferOpenssl- Whether OpenSSL should be preferred
-
readExisting
protected final void readExisting(SslConfiguration defaultSslConfiguration, SslConfiguration.KeyConfiguration defaultKeyConfiguration, SslConfiguration.KeyStoreConfiguration defaultKeyStoreConfiguration, SslConfiguration.TrustStoreConfiguration defaultTrustStoreConfiguration) Reads an existing config.- Parameters:
defaultSslConfiguration- The default SSL configdefaultKeyConfiguration- The default key configdefaultKeyStoreConfiguration- The default keystore configdefaultTrustStoreConfiguration- The Default truststore config
-
micronaut.server.ssl.build-self-signedinstead (buildSelfSigned()).