簡體   English   中英

Azure API 管理 - 機器相關客戶端證書創建

[英]Azure API Management - Machine dependent client certificate creation

我創建了 API 並在https://docs.microsoft.com/en-us/learn/modules/control-authentication-with-apim/1-introduction的幫助下實現了訂閱+基於證書的身份驗證的功能。這個實現當前為特定用戶提供安全性。 如果我向另一個用戶提供相同的訂閱和證書,那么 API 也會被訪問。 您能解釋一下如何避免這種情況嗎? 請您指導我如何通過 Azure API 管理提供基於機器的認證訪問?

根據您在問題中提供的教程,有幾個屬性供用戶設置驗證策略。 實踐中的示例策略是基於指紋<when condition="@(context.Request.Certificate == null || context.Request.Certificate.Thumbprint != "desired-thumbprint")" >

在此處輸入圖像描述

這導致了您在問題中提到的情況。 如果你想設置基於機器的認證訪問策略,你需要改變判斷條件。 例如,您想讓您的 API 可供受信任的主體訪問,您可以像這樣更改策略:

<inbound>
   <base />
   <choose>
       <when condition="@(context.Request.Certificate == null 
       || context.Request.Certificate.Issuer != "CN=client-daemon.mycustomdomain.com, OU=Azure, O=tosokr.github.io, L=Amsterdam, S=North Holland, C=NL" 
       || context.Request.Certificate.SubjectName.Name != "CN=*.mycustomdomain.com")">
         <return-response>
             <set-status code="403" reason="Invalid client certificate" />
         </return-response>
       </when>
   </choose>
 </inbound>

更多示例可以參考這個博客

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM