if (!isRequestor(message)) {
assertHttps(ais, message);
// Store the TLS principal on the message context
SecurityContext sc = message.get(SecurityContext.class);
if (sc == null || sc.getUserPrincipal() == null) {
TLSSessionInfo tlsInfo = message.get(TLSSessionInfo.class);
if (tlsInfo != null && tlsInfo.getPeerCertificates() != null
&& tlsInfo.getPeerCertificates().length > 0
&& (tlsInfo.getPeerCertificates()[0] instanceof X509Certificate)
) {
X509Certificate cert = (X509Certificate)tlsInfo.getPeerCertificates()[0];
message.put(
SecurityContext.class, createSecurityContext(cert.getSubjectX500Principal())
);
}
}