RequiredScopeAttribute 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
此属性用于控制器、页面或控制器操作来声明 Web 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
- 属性
- 实现
构造函数
| 名称 | 说明 |
|---|---|
| RequiredScopeAttribute() |
默认构造函数。 |
| RequiredScopeAttribute(String[]) |
验证是否使用正确的作用域调用 Web API。
如果为此 API 获取的令牌代表经过身份验证的用户在其范围声明中没有任何这些 |
属性
| 名称 | 说明 |
|---|---|
| AcceptedScope |
此 Web API 接受的范围。 |
| IsReusable |
未使用:与授权筛选器的接口兼容性。 |
| RequiredScopesConfigurationKey |
包含所需作用域(用空格分隔)的配置密钥的完全限定名称。 |