[英]What do key, audience, claim, and issuer mean for OAuth2 in Azure's <validate-jwt> tag?
我正在嘗試在Azure中配置API,以便它使用OAuth2來驗證對API的調用。 OAuth2服務器已經按照我在網上找到的說明進行了設置和鏈接。 但是,在API端檢查令牌時遇到了麻煩。 為此,我在以下位置在線找到了一個教程: https ://docs.microsoft.com/zh-cn/azure/api-management/api-management-access-restriction-policies
這里提供了以下模板,用於將API入站檢查添加到您的API中以驗證JWT:
<validate-jwt
header-name="name of http header containing the token (use query-parameter-name attribute if the token is passed in the URL)"
failed-validation-httpcode="http status code to return on failure"
failed-validation-error-message="error message to return on failure"
require-expiration-time="true|false"
require-scheme="scheme"
require-signed-tokens="true|false"
clock-skew="allowed clock skew in seconds">
<issuer-signing-keys>
<key>base64 encoded signing key</key>
<!-- if there are multiple keys, then add additional key elements -->
</issuer-signing-keys>
<audiences>
<audience>audience string</audience>
<!-- if there are multiple possible audiences, then add additional audience elements -->
</audiences>
<issuers>
<issuer>issuer string</issuer>
<!-- if there are multiple possible issuers, then add additional issuer elements -->
</issuers>
<required-claims>
<claim name="name of the claim as it appears in the token" match="all|any" separator="separator character in a multi-valued claim">
<value>claim value as it is expected to appear in the token</value>
<!-- if there is more than one allowed values, then add additional value elements -->
</claim>
<!-- if there are multiple possible allowed values, then add additional value elements -->
</required-claims>
<openid-config url="full URL of the configuration endpoint, e.g. https://login.constoso.com/openid-configuration" />
<zumo-master-key id="key identifier">key value</zumo-master-key>
</validate-jwt>
由於沒有在任何地方明確聲明,因此任何人都可以闡明密鑰,受眾,索賠和發行者的價值含義以及在何處可以找到此信息嗎?
您似乎在您提到的文章中錯過了它們。
issuer-signing-keys
:用於驗證簽名令牌的Base64編碼的安全密鑰的列表。 如果存在多個安全密鑰,則嘗試每個密鑰,直到全部用盡(在這種情況下,驗證失敗)或直到一個成功(對令牌翻轉有用)。 關鍵元素具有可選的id
屬性,用於匹配kid
要求。
audiences
:包含可以在令牌上顯示的可接受的聽眾聲明的列表。 如果存在多個受眾值,則嘗試每個值,直到所有值都用盡(在這種情況下,驗證失敗)或一個值成功為止。 必須指定至少一位觀眾。
required-claims
:包含預期在令牌上出現的聲明列表,以使其被視為有效。 當match
屬性設置為all
時,令牌中必須存在策略中的每個聲明值,驗證才能成功。 當match
屬性設置為any
屬性時,令牌中必須至少存在一個聲明,以使驗證成功。
issuers
:發行令牌的可接受委托人列表。 如果存在多個頒發者值,則嘗試每個值,直到全部用盡(在這種情況下驗證失敗)或一個值成功為止。
有關更多詳細信息,請參考此鏈接 。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.