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
Modifier and TypeClassDescriptionstatic class
Configuration properties for SSL key.static class
Configuration properties for SSL key store.static class
Configuration properties for SSL trust store. -
Field Summary
Modifier and TypeFieldDescriptionprotected boolean
static final boolean
The default build self signed value.static final boolean
The default enable value.static final int
The default port value.static final String
The default protocol.protected int
static final String
The prefix used to resolve this configuration. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
getKey()
int
getPort()
boolean
protected final void
readExisting
(SslConfiguration defaultSslConfiguration, SslConfiguration.KeyConfiguration defaultKeyConfiguration, SslConfiguration.KeyStoreConfiguration defaultKeyStoreConfiguration, SslConfiguration.TrustStoreConfiguration defaultTrustStoreConfiguration) Reads an existing config.void
setBuildSelfSigned
(boolean buildSelfSigned) Deprecated.void
setCiphers
(String[] ciphers) Sets the ciphers to use.void
setClientAuthentication
(ClientAuthentication clientAuthentication) Sets the client authentication mode.void
setEnabled
(boolean enabled) Whether SSL is enabled.void
setHandshakeTimeout
(@NonNull Duration handshakeTimeout) void
Sets the key configuration.void
Sets the keystore configuration.void
setPort
(int port) Deprecated.Please usemicronaut.server.ssl.port
instead (ServerSslConfiguration.setPort(int)
).void
setProtocol
(String protocol) Sets the protocol to use.void
setProtocols
(String[] protocols) Sets the protocols to use.void
Sets 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:
isEnabled
in 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 or not 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.port
instead (ServerSslConfiguration.setPort(int)
).Sets the SSL port. Default value (8443).- Parameters:
port
- The port
-
setBuildSelfSigned
Deprecated.Please usemicronaut.server.ssl.build-self-signed
instead (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
-
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-signed
instead (buildSelfSigned()
).