Language

RequiredScopeAttribute クラス

定義

この属性は、コントローラー、ページ、またはコントローラー アクションで使用され、Web API で必要なスコープを宣言 (および検証) します。 これらのスコープは、ハードコーディングするか、構成で宣言するかの 2 つの方法で宣言できます。 選択に応じて、どちらか一方のコンストラクターを使用します。 詳細については、 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
属性
実装

コンストラクター

名前 説明
RequiredScopeAttribute()

既定のコンストラクター

RequiredScopeAttribute(String[])

Web API が適切なスコープで呼び出されていることを確認します。 この API に対して取得されたトークンがそのスコープ要求にこれらの acceptedScopes を持っていない場合、メソッドは状態コード 403 (Forbidden) を提供する HTTP 応答を更新し、トークンで必要なスコープを示すメッセージを応答本文に書き込みます。

プロパティ

名前 説明
AcceptedScope

この Web API で受け入れられるスコープ。

IsReusable

未使用: 承認フィルターとのインターフェイスの互換性。

RequiredScopesConfigurationKey

必要なスコープを含む構成キーの完全修飾名 (スペースで区切ります)。

適用対象