Package org.mockserver.socket.tls
Class NettySslContextFactory
java.lang.Object
org.mockserver.socket.tls.NettySslContextFactory
- Author:
- jamesdbloom
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic Function<io.netty.handler.ssl.SslContextBuilder,io.netty.handler.ssl.SslContext> static Consumer<NettySslContextFactory>static UnaryOperator<io.netty.handler.ssl.SslContextBuilder>static UnaryOperator<io.netty.handler.ssl.SslContextBuilder> -
Constructor Summary
ConstructorsConstructorDescriptionNettySslContextFactory(Configuration configuration, MockServerLogger mockServerLogger, boolean forServer) NettySslContextFactory(MockServerLogger mockServerLogger) Deprecated.use constructor that specifies configuration explicitly -
Method Summary
Modifier and TypeMethodDescriptionio.netty.handler.ssl.SslContextcreateClientSslContext(boolean forwardProxyClient, boolean enableHttp2) io.netty.handler.ssl.SslContextcreateClientSslContext(boolean forwardProxyClient, boolean enableHttp2, String host) Build (or return the cached) outbound clientSslContextfor connecting to an upstream.io.netty.handler.ssl.SslContextbooleantrustCertificateChain(String tlsMutualAuthenticationCertificateChain) withClientSslContextBuilderFunction(Function<io.netty.handler.ssl.SslContextBuilder, io.netty.handler.ssl.SslContext> clientSslContextBuilderFunction)
-
Field Details
-
clientSslContextBuilderFunction
public static Function<io.netty.handler.ssl.SslContextBuilder,io.netty.handler.ssl.SslContext> clientSslContextBuilderFunction -
nettySslContextFactoryCustomizer
-
sslServerContextBuilderCustomizer
public static UnaryOperator<io.netty.handler.ssl.SslContextBuilder> sslServerContextBuilderCustomizer -
sslClientContextBuilderCustomizer
public static UnaryOperator<io.netty.handler.ssl.SslContextBuilder> sslClientContextBuilderCustomizer
-
-
Constructor Details
-
NettySslContextFactory
Deprecated.use constructor that specifies configuration explicitly -
NettySslContextFactory
public NettySslContextFactory(Configuration configuration, MockServerLogger mockServerLogger, boolean forServer)
-
-
Method Details
-
withClientSslContextBuilderFunction
public NettySslContextFactory withClientSslContextBuilderFunction(Function<io.netty.handler.ssl.SslContextBuilder, io.netty.handler.ssl.SslContext> clientSslContextBuilderFunction) -
createClientSslContext
public io.netty.handler.ssl.SslContext createClientSslContext(boolean forwardProxyClient, boolean enableHttp2) -
createClientSslContext
public io.netty.handler.ssl.SslContext createClientSslContext(boolean forwardProxyClient, boolean enableHttp2, String host) Build (or return the cached) outbound clientSslContextfor connecting to an upstream.When
hosthas a per-host client certificate/key mapping configured viaforwardProxyClientCertificatesByHost, that host's cert/key pair is presented for outbound mTLS; otherwise the globalforwardProxyPrivateKey/forwardProxyCertificateChainpair (or MockServer's own generated key/cert) is used, exactly as before. Contexts are cached: every host that resolves to the global pair shares one cached context (so the cache cannot grow unbounded across many upstream hosts), while each host with its own mapping gets its own context.- Parameters:
host- the upstream target host (may be null/blank — then only the global pair is ever used)
-
createServerSslContext
public io.netty.handler.ssl.SslContext createServerSslContext() -
trustCertificateChain
-
isForServer
public boolean isForServer()
-