From 9be52cb2c93ff41af18ebfa7fc08c9ed10319dfa Mon Sep 17 00:00:00 2001 From: Johannes Rudolph Date: Tue, 21 Feb 2017 11:00:25 +0100 Subject: [PATCH] +str #22345 #21854 provide forward compatible TLS constructor in stream TLS This method will be consumed mainly by akka-http. (cherry picked from commit 7b7a82c1c13dce5710c6cc2923fc7490666d8c79) --- .../src/main/scala/akka/stream/scaladsl/TLS.scala | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/akka-stream/src/main/scala/akka/stream/scaladsl/TLS.scala b/akka-stream/src/main/scala/akka/stream/scaladsl/TLS.scala index cfb35821ca..50723a31e9 100644 --- a/akka-stream/src/main/scala/akka/stream/scaladsl/TLS.scala +++ b/akka-stream/src/main/scala/akka/stream/scaladsl/TLS.scala @@ -167,6 +167,20 @@ object TLS { closing: TLSClosing ): scaladsl.BidiFlow[SslTlsOutbound, ByteString, ByteString, SslTlsInbound, NotUsed] = new scaladsl.BidiFlow(TlsModule(Attributes.none, _ ⇒ createSSLEngine(), (_, session) ⇒ verifySession(session), closing)) + + /** + * Create a StreamTls [[akka.stream.scaladsl.BidiFlow]]. This is a low-level interface. + * + * You can specify a constructor to create an SSLEngine that must already be configured for + * client and server mode and with all the parameters for the first session. + * + * For a description of the `closing` parameter please refer to [[TLSClosing]]. + */ + def apply( + createSSLEngine: () ⇒ SSLEngine, // we don't offer the internal `ActorSystem => SSLEngine` API here, see #21753 + closing: TLSClosing + ): scaladsl.BidiFlow[SslTlsOutbound, ByteString, ByteString, SslTlsInbound, NotUsed] = + apply(createSSLEngine, _ ⇒ Success(()), closing) } /**