所以我正在关注此链接:https://learn.microsoft.com/en-gb/azure/api-management/api-management-howto-mutual-certificates-for-clients 。我添加了两项政策 -
1)检查指纹(对于包含证书的传入请求)
<choose>
<when condition="@(context.Request.Certificate == null || !context.Request.Certificate.Verify() || context.Request.Certificate.Thumbprint != "DESIRED-THUMBPRINT-IN-UPPER-CASE")" >
<return-response>
<set-status code="403" reason="Invalid client certificate" />
</return-response>
</when>
</choose>
2)根据上传到 API 管理的证书检查指纹(我在 APIM 的“证书”部分上传了自签名证书)
<choose>
<when condition="@(context.Request.Certificate == null || !context.Request.Certificate.Verify() || !context.Deployment.Certificates.Any(c => c.Value.Thumbprint == context.Request.Certificate.Thumbprint))" >
<return-response>
<set-status code="403" reason="Invalid client certificate" />
</return-response>
</when>
现在,当我尝试在 azure 中从 APIM 发送 get 请求时,我遇到一个错误,提示“403 无效的客户端证书”。在 postman 中,我也添加了证书,但在发送 get 时遇到相同的错误请求。
我使用 openssl 制作了自签名证书并将其转换为 .key 、 .crt 和 .pfx。我也阅读了其他相关线程,但我没有找到此问题的任何解决方案。我不知道我是否做错了或者我我错过了一些东西。请帮我解决这个问题。谢谢。
最佳答案
关于azure - 在 Azure APIM 以及 postman 中获取 "403 Invalid client certificate",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62059889/