public class ConfigurationProperties extends Object
Constructor and Description |
---|
ConfigurationProperties() |
Modifier and Type | Method and Description |
---|---|
static int |
actionHandlerThreadCount() |
static void |
actionHandlerThreadCount(int count) |
static void |
addSslSubjectAlternativeNameDomains(String... additionalSubjectAlternativeNameDomains) |
static void |
addSslSubjectAlternativeNameIps(String... additionalSubjectAlternativeNameIps) |
static void |
addSubjectAlternativeName(String host) |
static boolean |
alwaysCloseSocketConnections() |
static void |
alwaysCloseSocketConnections(boolean alwaysClose) |
static boolean |
attemptToProxyIfNoMatchingExpectation() |
static void |
attemptToProxyIfNoMatchingExpectation(boolean enable)
If true (the default) when no matching expectation is found, and the host header of the request does not match MockServer's host, then MockServer attempts to proxy the request if that fails then a 404 is returned.
|
static String |
certificateAuthorityCertificate() |
static void |
certificateAuthorityCertificate(String certificateAuthorityCertificate)
File location of custom X.509 Certificate for Certificate Authority for TLS, the certificate must be a X509 PEM file and must match the certificateAuthorityPrivateKey
|
static String |
certificateAuthorityPrivateKey() |
static void |
certificateAuthorityPrivateKey(String certificateAuthorityPrivateKey)
File location of custom Private Key for Certificate Authority for TLS, the private key must be a PKCS#8 PEM file and must match the certificateAuthorityCertificate
To convert a PKCS#1 (i.e.
|
static void |
clearSslSubjectAlternativeNameDomains() |
static void |
clearSslSubjectAlternativeNameIps() |
static boolean |
containsSslSubjectAlternativeName(String domainOrIp) |
static boolean |
corsAllowCredentials() |
static void |
corsAllowCredentials(boolean allow) |
static String |
corsAllowHeaders() |
static void |
corsAllowHeaders(String corsAllowHeaders) |
static String |
corsAllowMethods() |
static void |
corsAllowMethods(String corsAllowMethods) |
static int |
corsMaxAgeInSeconds() |
static void |
corsMaxAgeInSeconds(int ageInSeconds) |
static boolean |
detailedMatchFailures() |
static void |
detailedMatchFailures(boolean enable)
If true (the default) the log event recording that a request matcher did not match will include a detailed reason why each non matching field did not match.
|
static String |
directoryToSaveDynamicSSLCertificate() |
static void |
directoryToSaveDynamicSSLCertificate(String directoryToSaveDynamicSSLCertificate)
Directory used to save the dynamically generated Certificate Authority X.509 Certificate and Private Key.
|
static boolean |
disableSystemOut() |
static void |
disableSystemOut(boolean disable) |
static boolean |
dynamicallyCreateCertificateAuthorityCertificate() |
static void |
dynamicallyCreateCertificateAuthorityCertificate(boolean enable)
Enable dynamic creation of Certificate Authority X509 certificate and private key.
|
static boolean |
enableCORSForAllResponses() |
static void |
enableCORSForAllResponses(boolean enable) |
static boolean |
enableCORSForAPI() |
static void |
enableCORSForAPI(boolean enable) |
static boolean |
enableCORSForAPIHasBeenSetExplicitly() |
static InetSocketAddress |
forwardHttpProxy() |
static void |
forwardHttpProxy(String hostAndPort) |
static InetSocketAddress |
forwardHttpsProxy() |
static void |
forwardHttpsProxy(String hostAndPort) |
static String |
forwardProxyAuthenticationPassword() |
static void |
forwardProxyAuthenticationPassword(String forwardProxyAuthenticationPassword) |
static String |
forwardProxyAuthenticationUsername() |
static void |
forwardProxyAuthenticationUsername(String forwardProxyAuthenticationUsername) |
static String |
forwardProxyCertificateChain() |
static void |
forwardProxyCertificateChain(String certificateChain)
File location of custom mTLS (TLS client authentication) X.509 Certificate Chain for Trusting (i.e.
|
static String |
forwardProxyPrivateKey() |
static void |
forwardProxyPrivateKey(String privateKey)
File location of custom Private Key for proxied TLS connections out of MockServer, the private key must be a PKCS#8 PEM file
|
static String |
forwardProxyTLSCustomTrustX509Certificates() |
static void |
forwardProxyTLSCustomTrustX509Certificates(String customX509Certificates)
File location of custom file for trusted X509 Certificate Authority roots for forwarded or proxied requests, the certificate chain must be a X509 PEM file.
|
static ForwardProxyTLSX509CertificatesTrustManager |
forwardProxyTLSX509CertificatesTrustManagerType() |
static void |
forwardProxyTLSX509CertificatesTrustManagerType(String trustManagerType)
Configure trusted set of certificates for forwarded or proxied requests.
|
static InetSocketAddress |
forwardSocksProxy() |
static void |
forwardSocksProxy(String hostAndPort) |
static InetSocketAddress |
httpProxy()
Deprecated.
use forwardHttpProxy instead
|
static void |
httpProxy(String hostAndPort)
Deprecated.
use forwardHttpProxy instead
|
static InetSocketAddress |
httpsProxy()
Deprecated.
use forwardHttpsProxy instead
|
static void |
httpsProxy(String hostAndPort)
Deprecated.
use forwardHttpsProxy instead
|
static String |
initializationClass() |
static void |
initializationClass(String initializationClass) |
static String |
initializationJsonPath() |
static void |
initializationJsonPath(String initializationJsonPath) |
static String |
javaLoggerLogLevel() |
static String |
livenessHttpGetPath() |
static void |
livenessHttpGetPath(String livenessPath)
Path to support HTTP GET requests for status response (also available on PUT /mockserver/status).
|
static String |
localBoundIP() |
static void |
localBoundIP(String localBoundIP) |
static org.slf4j.event.Level |
logLevel() |
static void |
logLevel(String level)
Override the default logging level of INFO
|
static boolean |
matchersFailFast() |
static void |
matchersFailFast(boolean enable)
If true (the default) request matchers will fail on the first non-matching field, if false request matchers will compare all fields.
|
static int |
maxChunkSize() |
static void |
maxChunkSize(int size) |
static int |
maxExpectations() |
static void |
maxExpectations(int count) |
static long |
maxFutureTimeout() |
static void |
maxFutureTimeout(long milliseconds) |
static int |
maxHeaderSize() |
static void |
maxHeaderSize(int size) |
static int |
maxInitialLineLength() |
static void |
maxInitialLineLength(int length) |
static int |
maxLogEntries() |
static void |
maxLogEntries(int count) |
static long |
maxSocketTimeout() |
static void |
maxSocketTimeout(long milliseconds) |
static int |
maxWebSocketExpectations() |
static void |
maxWebSocketExpectations(int count) |
static boolean |
metricsEnabled() |
static void |
metricsEnabled(boolean enable) |
static int |
nioEventLoopThreadCount() |
static void |
nioEventLoopThreadCount(int count) |
static String |
persistedExpectationsPath() |
static void |
persistedExpectationsPath(String persistedExpectationsPath) |
static boolean |
persistExpectations() |
static void |
persistExpectations(boolean enable) |
static boolean |
preventCertificateDynamicUpdate() |
static void |
preventCertificateDynamicUpdate(boolean prevent)
Prevent certificates from dynamically updating when domain list changes
|
static String |
privateKeyPath() |
static void |
privateKeyPath(String privateKeyPath)
File location of a fixed custom private key for TLS connections into MockServer.
|
static String |
proxyAuthenticationPassword() |
static void |
proxyAuthenticationPassword(String proxyAuthenticationPassword) |
static String |
proxyAuthenticationRealm() |
static void |
proxyAuthenticationRealm(String proxyAuthenticationRealm) |
static String |
proxyAuthenticationUsername() |
static void |
proxyAuthenticationUsername(String proxyAuthenticationUsername) |
static boolean |
rebuildServerTLSContext() |
static void |
rebuildServerTLSContext(boolean rebuildServerTLSContext) |
static boolean |
rebuildTLSContext() |
static void |
rebuildTLSContext(boolean rebuildTLSContext) |
static int |
ringBufferSize() |
static int |
socketConnectionTimeout() |
static void |
socketConnectionTimeout(int milliseconds) |
static InetSocketAddress |
socksProxy()
Deprecated.
use forwardSocksProxy instead
|
static void |
socksProxy(String hostAndPort)
Deprecated.
use forwardSocksProxy instead
|
static String |
sslCertificateDomainName() |
static void |
sslCertificateDomainName(String domainName) |
static String[] |
sslSubjectAlternativeNameDomains() |
static String[] |
sslSubjectAlternativeNameIps() |
static String |
tlsMutualAuthenticationCertificateChain() |
static void |
tlsMutualAuthenticationCertificateChain(String trustCertificateChain)
File location of custom mTLS (TLS client authentication) X.509 Certificate Chain for Trusting (i.e.
|
static boolean |
tlsMutualAuthenticationRequired() |
static void |
tlsMutualAuthenticationRequired(boolean enable)
Require mTLS (also called client authentication and two-way TLS) for all TLS connections / HTTPS requests to MockServer
|
static boolean |
watchInitializationJson() |
static void |
watchInitializationJson(boolean enable) |
static int |
webSocketClientEventLoopThreadCount() |
static void |
webSocketClientEventLoopThreadCount(int count) |
static String |
x509CertificatePath() |
static void |
x509CertificatePath(String x509CertificatePath)
File location of a fixed custom X.509 Certificate for TLS connections into MockServer.
|
public static int maxExpectations()
public static void maxExpectations(int count)
public static int maxLogEntries()
public static void maxLogEntries(int count)
public static int ringBufferSize()
public static int maxWebSocketExpectations()
public static void maxWebSocketExpectations(int count)
public static int maxInitialLineLength()
public static void maxInitialLineLength(int length)
public static int maxHeaderSize()
public static void maxHeaderSize(int size)
public static int maxChunkSize()
public static void maxChunkSize(int size)
public static int nioEventLoopThreadCount()
public static void nioEventLoopThreadCount(int count)
public static int actionHandlerThreadCount()
public static void actionHandlerThreadCount(int count)
public static int webSocketClientEventLoopThreadCount()
public static void webSocketClientEventLoopThreadCount(int count)
public static long maxSocketTimeout()
public static void maxSocketTimeout(long milliseconds)
public static long maxFutureTimeout()
public static void maxFutureTimeout(long milliseconds)
public static int socketConnectionTimeout()
public static void socketConnectionTimeout(int milliseconds)
public static void alwaysCloseSocketConnections(boolean alwaysClose)
public static boolean alwaysCloseSocketConnections()
public static String sslCertificateDomainName()
public static void sslCertificateDomainName(String domainName)
public static void addSubjectAlternativeName(String host)
public static String[] sslSubjectAlternativeNameDomains()
public static void addSslSubjectAlternativeNameDomains(String... additionalSubjectAlternativeNameDomains)
public static void clearSslSubjectAlternativeNameDomains()
public static boolean containsSslSubjectAlternativeName(String domainOrIp)
public static String[] sslSubjectAlternativeNameIps()
public static void addSslSubjectAlternativeNameIps(String... additionalSubjectAlternativeNameIps)
public static void clearSslSubjectAlternativeNameIps()
public static boolean rebuildTLSContext()
public static void rebuildTLSContext(boolean rebuildTLSContext)
public static boolean rebuildServerTLSContext()
public static void rebuildServerTLSContext(boolean rebuildServerTLSContext)
public static void preventCertificateDynamicUpdate(boolean prevent)
prevent
- prevent certificates from dynamically updating when domain list changespublic static boolean preventCertificateDynamicUpdate()
public static String certificateAuthorityPrivateKey()
public static void certificateAuthorityPrivateKey(String certificateAuthorityPrivateKey)
certificateAuthorityPrivateKey
- location of the PEM file containing the certificate authority private keypublic static String certificateAuthorityCertificate()
public static void certificateAuthorityCertificate(String certificateAuthorityCertificate)
certificateAuthorityCertificate
- location of the PEM file containing the certificate authority X509 certificatepublic static boolean dynamicallyCreateCertificateAuthorityCertificate()
public static void dynamicallyCreateCertificateAuthorityCertificate(boolean enable)
Enable this property to increase the security of trusting the MockServer Certificate Authority X509 by ensuring a local dynamic value is used instead of the public value in the MockServer git repo.
These PEM files will be created and saved in the directory specified with configuration property directoryToSaveDynamicSSLCertificate.
enable
- dynamic creation of Certificate Authority X509 certificate and private key.public static String directoryToSaveDynamicSSLCertificate()
public static void directoryToSaveDynamicSSLCertificate(String directoryToSaveDynamicSSLCertificate)
directoryToSaveDynamicSSLCertificate
- directory to save Certificate Authority X.509 Certificate and Private Keypublic static String privateKeyPath()
public static void privateKeyPath(String privateKeyPath)
The private key must be a PKCS#8 PEM file and must be the private key corresponding to the x509CertificatePath X509 (public key) configuration. The certificateAuthorityCertificate configuration must be the Certificate Authority for the corresponding X509 certificate (i.e. able to valid its signature), see: x509CertificatePath.
To convert a PKCS#1 (i.e. default for Bouncy Castle) to a PKCS#8 the following command can be used: openssl pkcs8 -topk8 -inform PEM -in private_key_PKCS_1.pem -out private_key_PKCS_8.pem -nocrypt
This configuration will be ignored unless x509CertificatePath is also set.
privateKeyPath
- location of the PKCS#8 PEM file containing the private keypublic static String x509CertificatePath()
public static void x509CertificatePath(String x509CertificatePath)
The certificate must be a X509 PEM file and must be the public key corresponding to the privateKeyPath private key configuration. The certificateAuthorityCertificate configuration must be the Certificate Authority for this certificate (i.e. able to valid its signature).
This configuration will be ignored unless privateKeyPath is also set.
x509CertificatePath
- location of the PEM file containing the X509 certificatepublic static boolean tlsMutualAuthenticationRequired()
public static void tlsMutualAuthenticationRequired(boolean enable)
enable
- TLS mutual authenticationpublic static String tlsMutualAuthenticationCertificateChain()
public static void tlsMutualAuthenticationCertificateChain(String trustCertificateChain)
This certificate chain will be used if MockServer performs mTLS (client authentication) for inbound TLS connections because tlsMutualAuthenticationRequired is enabled
trustCertificateChain
- file location of custom mTLS (TLS client authentication) X.509 Certificate Chain for Trusting (i.e. signature verification of) Client X.509 Certificatespublic static ForwardProxyTLSX509CertificatesTrustManager forwardProxyTLSX509CertificatesTrustManagerType()
public static void forwardProxyTLSX509CertificatesTrustManagerType(String trustManagerType)
MockServer will only be able to establish a TLS connection to endpoints that have a trusted X509 certificate according to the trust manager type, as follows:
ALL - Insecure will trust all X509 certificates and not perform host name verification. JVM - Will trust all X509 certificates trust by the JVM. CUSTOM - Will trust all X509 certificates specified in forwardProxyTLSCustomTrustX509Certificates configuration value.
trustManagerType
- trusted set of certificates for forwarded or proxied requests, allowed values: ALL, JVM, CUSTOM.public static String forwardProxyTLSCustomTrustX509Certificates()
public static void forwardProxyTLSCustomTrustX509Certificates(String customX509Certificates)
MockServer will only be able to establish a TLS connection to endpoints that have an X509 certificate chain that is signed by one of the provided custom certificates, i.e. where a path can be established from the endpoints X509 certificate to one or more of the custom X509 certificates provided.
customX509Certificates
- custom set of trusted X509 certificate authority roots for forwarded or proxied requests in PEM format.public static String forwardProxyPrivateKey()
public static void forwardProxyPrivateKey(String privateKey)
To convert a PKCS#1 (i.e. default for Bouncy Castle) to a PKCS#8 the following command can be used: openssl pkcs8 -topk8 -inform PEM -in private_key_PKCS_1.pem -out private_key_PKCS_8.pem -nocrypt
This private key will be used if MockServer needs to perform mTLS (client authentication) for outbound TLS connections.
privateKey
- location of the PEM file containing the private keypublic static String forwardProxyCertificateChain()
public static void forwardProxyCertificateChain(String certificateChain)
This certificate chain will be used if MockServer needs to perform mTLS (client authentication) for outbound TLS connections.
certificateChain
- location of the PEM file containing the certificate chainpublic static org.slf4j.event.Level logLevel()
public static String javaLoggerLogLevel()
public static void logLevel(String level)
level
- the log level, which can be TRACE, DEBUG, INFO, WARN, ERROR, OFF, FINEST, FINE, INFO, WARNING, SEVEREpublic static boolean disableSystemOut()
public static void disableSystemOut(boolean disable)
public static boolean detailedMatchFailures()
public static void detailedMatchFailures(boolean enable)
enable
- enabled detailed match failure log eventspublic static boolean matchersFailFast()
public static void matchersFailFast(boolean enable)
enable
- enabled request matchers failing fastpublic static boolean metricsEnabled()
public static void metricsEnabled(boolean enable)
public static String localBoundIP()
public static void localBoundIP(String localBoundIP)
public static boolean attemptToProxyIfNoMatchingExpectation()
public static void attemptToProxyIfNoMatchingExpectation(boolean enable)
enable
- enables automatically attempted proxying of request that don't match an expectation and look like they should be proxied@Deprecated public static InetSocketAddress httpProxy()
@Deprecated public static void httpProxy(String hostAndPort)
@Deprecated public static InetSocketAddress httpsProxy()
@Deprecated public static void httpsProxy(String hostAndPort)
@Deprecated public static InetSocketAddress socksProxy()
@Deprecated public static void socksProxy(String hostAndPort)
public static InetSocketAddress forwardHttpProxy()
public static void forwardHttpProxy(String hostAndPort)
public static InetSocketAddress forwardHttpsProxy()
public static void forwardHttpsProxy(String hostAndPort)
public static InetSocketAddress forwardSocksProxy()
public static void forwardSocksProxy(String hostAndPort)
public static String forwardProxyAuthenticationUsername()
public static void forwardProxyAuthenticationUsername(String forwardProxyAuthenticationUsername)
public static String forwardProxyAuthenticationPassword()
public static void forwardProxyAuthenticationPassword(String forwardProxyAuthenticationPassword)
public static String proxyAuthenticationRealm()
public static void proxyAuthenticationRealm(String proxyAuthenticationRealm)
public static String proxyAuthenticationUsername()
public static void proxyAuthenticationUsername(String proxyAuthenticationUsername)
public static String proxyAuthenticationPassword()
public static void proxyAuthenticationPassword(String proxyAuthenticationPassword)
public static String initializationClass()
public static void initializationClass(String initializationClass)
public static String initializationJsonPath()
public static void initializationJsonPath(String initializationJsonPath)
public static boolean watchInitializationJson()
public static void watchInitializationJson(boolean enable)
public static boolean persistExpectations()
public static void persistExpectations(boolean enable)
public static String persistedExpectationsPath()
public static void persistedExpectationsPath(String persistedExpectationsPath)
public static boolean enableCORSForAPI()
public static boolean enableCORSForAPIHasBeenSetExplicitly()
public static void enableCORSForAPI(boolean enable)
public static boolean enableCORSForAllResponses()
public static void enableCORSForAllResponses(boolean enable)
public static String corsAllowHeaders()
public static void corsAllowHeaders(String corsAllowHeaders)
public static String corsAllowMethods()
public static void corsAllowMethods(String corsAllowMethods)
public static boolean corsAllowCredentials()
public static void corsAllowCredentials(boolean allow)
public static int corsMaxAgeInSeconds()
public static void corsMaxAgeInSeconds(int ageInSeconds)
public static String livenessHttpGetPath()
public static void livenessHttpGetPath(String livenessPath)
If this value is not modified then only PUT /mockserver/status but is a none blank value is provided for this value then GET requests to this path will return the 200 Ok status response showing the MockServer version and bound ports.
A GET request to this path will be matched before any expectation matching or proxying of requests.
livenessPath
- path to support HTTP GET requests for status responseCopyright © 2020. All rights reserved.