|
From: Aaron B. <aar...@gm...> - 2019-08-27 17:31:14
|
Hello,
I've been digging through the source code for acceptors to figure out how
to get a handle to the underlying socket as connections are established. I
have two things I would like to do with that handle. In my case I am using
SSL with client certificate authentication. All of that is working properly
with the basic configuration options.
1) Add a handshake completed listener. The basic structure looks like
((SSLSocket) socket).addHandshakeCompletedListener(handshakeCompletedEvent
-> {
try {
X509Certificate cert =
(X509Certificate)handshakeCompletedEvent.getPeerCertificates()[0];
System.out.println(cert.getSubjectDN().getName());
} catch (SSLPeerUnverifiedException e) {
e.printStackTrace();
}
});
Ultimately there are some things I would like to extract from the client
certificate in order to authorize a connection and potentially kill it once
the certificate is available.
2) Extract a handle to the connection so it can be terminated. There may be
a reason to disable connections belonging to a session and I would like to
be able to wire up a mechanism to do that through the broader management
components of the platform.
|