-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finagle-core: Add SSL/TLS Session Information to ClientConnection
Problem We would like to be able to export and monitor more information about whether particular connections are using SSL/TLS, and if so, the specifics about that connection. For servers, we track connections based on information contained within the `ClientConnection` class. Solution Add `SslSessionInfo` to `ClientConnection` so that server connections can track whether connections are using SSL/TLS and the specifics related to a secure connection. Differential Revision: https://phabricator.twitter.biz/D323305
- Loading branch information
1 parent
03d1ad8
commit 69a28c1
Showing
8 changed files
with
48 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
finagle-core/src/test/scala/com/twitter/finagle/ClientConnectionProxyTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
package com.twitter.finagle | ||
|
||
import com.twitter.finagle.ssl.session.SslSessionInfo | ||
import org.mockito.Mockito.when | ||
import org.scalatest.FunSuite | ||
import org.scalatest.mockito.MockitoSugar | ||
|
||
class ClientConnectionProxyTest extends FunSuite with MockitoSugar { | ||
|
||
test("ClientConnectionProxy uses underlying SSL/TLS session info") { | ||
val sslSessionInfo: SslSessionInfo = mock[SslSessionInfo] | ||
val underlying: ClientConnection = mock[ClientConnection] | ||
when(underlying.sslSessionInfo).thenReturn(sslSessionInfo) | ||
val conn: ClientConnection = new ClientConnectionProxy(underlying) | ||
assert(conn.sslSessionInfo == sslSessionInfo) | ||
} | ||
|
||
} |
13 changes: 13 additions & 0 deletions
13
finagle-core/src/test/scala/com/twitter/finagle/ClientConnectionTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.twitter.finagle | ||
|
||
import com.twitter.finagle.ssl.session.NullSslSessionInfo | ||
import org.scalatest.FunSuite | ||
|
||
class ClientConnectionTest extends FunSuite { | ||
|
||
test("ClientConnection.nil has NullSslSessionInfo") { | ||
val conn: ClientConnection = ClientConnection.nil | ||
assert(conn.sslSessionInfo == NullSslSessionInfo) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters