Hi,
We would like to get the client IP during the TLS handshake. We have a class extending from X509ExtendedKeyManager and we are overriding the
public String chooseEngineServerAlias(String s, Principal[] principals, SSLEngine engine)
method.
@Override
public String chooseEngineServerAlias(String s, Principal[] principals, SSLEngine engine) {
String serverString = null;
if (engine != null) {
ExtendedSSLSession session = (ExtendedSSLSession)engine.getHandshakeSession();
if (session != null && session instanceof ExtendedSSLSession) {
LOG.info("Logging client IP address : " + session.getPeerHost());
//...
}
I even tried (which did not work either) -
LOG.info("Logging client IP address : " + session.getSessionContext()
.getSession(session.getId()).getPeerHost());
Above code does not seem to get the peer host, it returns null. Is there a way to get the client IP of the client initiating the handshake ?.