RequiredScopeAttribute.RequiredScopesConfigurationKey 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
包含所需作用域的配置鍵的完全限定名稱(以空格分隔)。
public string? RequiredScopesConfigurationKey { get; set; }
member this.RequiredScopesConfigurationKey : string with get, set
Public Property RequiredScopesConfigurationKey As String
屬性值
範例
如果 appsettings.json 檔案包含名為「AzureAd」的區段,其中一個名為「Scopes」的屬性包含所需的範圍,則要保護的控制器/頁面/動作上的屬性應設定為以下:
[RequiredScope(RequiredScopesConfigurationKey="AzureAd:Scopes")]