带有嵌入式 Tomcat 和通用名称 (CN) 的相互 TLS

Mutual TLS with embedded Tomcat and Common Name (CN)

我们 运行 使用嵌入式 Tomcat 的 REST 服务。我们的应用程序需要相互 TLS 进行身份验证和授权,方法是从客户端证书中提取 CN 并验证一组授权用户的权限。

这适用于反向代理,例如使用提取 CN 并在 HTTP 中传递的配置的 Nginx header:

proxy_set_header X-SSL-Client-CN $ssl_client_s_dn_cn;

相反,是否可以在嵌入式 Tomcat 中提取 CN 而不是使用反向代理?

.. 作为 Tomcat 提交者,我会说,RTFM。 SSLValve will read the Base 64 PEM public cert of your client, inject the X509Certificate and then your Realm可以提供一个X509UsernameRetriever来读出你所需要的