如果 IIS 客户端证书身份验证正常,则检查 nodeJS Express

Checking in nodeJS Express if IIS Client Cert Authentication went ok

我有一些客户端计算机使用客户端证书授权连接到我的 IIS 服务器。我在 IIS 上发布了一个 node.js webapp(使用 iisnode),它接收来自客户端的请求。

express 中有没有办法知道身份验证是否正确?我知道如果身份验证不正确,则 http 请求无法表达,因为它被拒绝了,但我需要一个字段来检查它是否正常,因为我在没有 ssl 的情况下访问同一个 webapp,而我只需要这个 particar 请求如果调用使用客户端 ssl 身份验证,则调用。

我尝试使用 req.socket.authorized 但它是 undefined 并且使用 req.socket.getPeerCertificate(true) 我得到 TypeError: req.socket.getPeerCertificate is not a function

req.secure

A Boolean property that is true if a TLS connection is established. Equivalent to:

'https' == req.protocol;

http://expressjs.com/en/api.html#req.secure