azure - 在 Azure APIM 以及 postman 中获取 "403 Invalid client certificate"

标签 azure ssl postman azure-api-management client-certificates

所以我正在关注此链接: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 时遇到相同的错误请求。

enter image description here

我使用 openssl 制作了自签名证书并将其转换为 .key 、 .crt 和 .pfx。我也阅读了其他相关线程,但我没有找到此问题的任何解决方案。我不知道我是否做错了或者我我错过了一些东西。请帮我解决这个问题。谢谢。

最佳答案

从您发布的文档链接:

Note

您的证书是自签名的,因此不可信。也尝试将其添加到 APIM 中的 CA 证书部分。

关于azure - 在 Azure APIM 以及 postman 中获取 "403 Invalid client certificate",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62059889/

相关文章:

cordova - 如何在不使用 ionic-native 的情况下使用插件?

c# - 如何从服务器 SSL 证书获取机器名

java - 如何用java写一个HTTPS web服务客户端?

http - 如何在 POSTMAN 中的 2 个请求之间添加暂停

docker - 尝试使用网关安全 token 向 Hawkbit 服务器发出 GET 请求时出现 401 错误

azure - 有没有办法在创建管道后编辑 azure-pipelines.yml ?

azure - 找不到此树项目的 Azure 订阅

python-3.x - Python 请求模块异常 SSLError

node.js - mongo中级联删除

Azure AD B2C 与 Azure AD Multi-Tenancy - 始终选择 MS 帐户登录的选项?