RequiredScopeAttribute 類別
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
此屬性用於控制器、頁面或控制器動作,用以宣告(並驗證)網頁 API 所需的作用範圍。 這些作用域可以透過兩種方式宣告:硬編碼,或在配置中宣告。 根據你的選擇,使用其中一種建造器。 如需詳細資訊,請參閱 https://aka.ms/ms-id-web/required-scope-attribute。
[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method)]
public class RequiredScopeAttribute : Attribute, Microsoft.Identity.Web.IAuthRequiredScopeMetadata
[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method)>]
type RequiredScopeAttribute = class
inherit Attribute
interface IAuthRequiredScopeMetadata
Public Class RequiredScopeAttribute
Inherits Attribute
Implements IAuthRequiredScopeMetadata
- 繼承
-
RequiredScopeAttribute
- 屬性
- 實作
建構函式
| 名稱 | Description |
|---|---|
| RequiredScopeAttribute() |
預設建構函式。 |
| RequiredScopeAttribute(String[]) |
驗證網頁 API 是否以正確的範圍呼叫。
若該 API 所取得的權杖代表已認證使用者,且其作用域主張中沒有這些 |
屬性
| 名稱 | Description |
|---|---|
| AcceptedScope |
此網頁 API 允許的範圍。 |
| IsReusable |
未使用:與授權過濾器介面相容性。 |
| RequiredScopesConfigurationKey |
包含所需作用域的配置鍵的完全限定名稱(以空格分隔)。 |