-
Notifications
You must be signed in to change notification settings - Fork 28
/
RequiredScopeAttribute.xml
206 lines (205 loc) Β· 10.6 KB
/
RequiredScopeAttribute.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
<Type Name="RequiredScopeAttribute" FullName="Microsoft.Identity.Web.Resource.RequiredScopeAttribute">
<TypeSignature Language="C#" Value="public class RequiredScopeAttribute : Attribute, Microsoft.Identity.Web.IAuthRequiredScopeMetadata" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit RequiredScopeAttribute extends System.Attribute implements class Microsoft.Identity.Web.IAuthRequiredScopeMetadata" />
<TypeSignature Language="DocId" Value="T:Microsoft.Identity.Web.Resource.RequiredScopeAttribute" />
<TypeSignature Language="VB.NET" Value="Public Class RequiredScopeAttribute
Inherits Attribute
Implements IAuthRequiredScopeMetadata" />
<TypeSignature Language="F#" Value="type RequiredScopeAttribute = class
 inherit Attribute
 interface IAuthRequiredScopeMetadata" />
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>2.11.0.0</AssemblyVersion>
<AssemblyVersion>2.11.1.0</AssemblyVersion>
<AssemblyVersion>2.12.4.0</AssemblyVersion>
<AssemblyVersion>2.13.0.0</AssemblyVersion>
<AssemblyVersion>2.13.1.0</AssemblyVersion>
<AssemblyVersion>2.13.2.0</AssemblyVersion>
<AssemblyVersion>2.13.3.0</AssemblyVersion>
<AssemblyVersion>2.13.4.0</AssemblyVersion>
<AssemblyVersion>2.14.0.0</AssemblyVersion>
<AssemblyVersion>2.15.1.0</AssemblyVersion>
<AssemblyVersion>2.15.2.0</AssemblyVersion>
<AssemblyVersion>2.15.3.0</AssemblyVersion>
<AssemblyVersion>2.15.5.0</AssemblyVersion>
<AssemblyVersion>2.16.0.0</AssemblyVersion>
<AssemblyVersion>2.16.1.0</AssemblyVersion>
<AssemblyVersion>2.17.0.0</AssemblyVersion>
<AssemblyVersion>2.17.1.0</AssemblyVersion>
<AssemblyVersion>2.17.2.0</AssemblyVersion>
<AssemblyVersion>2.17.3.0</AssemblyVersion>
<AssemblyVersion>2.17.4.0</AssemblyVersion>
<AssemblyVersion>2.17.5.0</AssemblyVersion>
<AssemblyVersion>2.18.1.0</AssemblyVersion>
<AssemblyVersion>2.18.2.0</AssemblyVersion>
<AssemblyVersion>2.19.0.0</AssemblyVersion>
<AssemblyVersion>2.19.1.0</AssemblyVersion>
<AssemblyVersion>2.20.0.0</AssemblyVersion>
<AssemblyVersion>3.0.0.0</AssemblyVersion>
<AssemblyVersion>3.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>Microsoft.Identity.Web.IAuthRequiredScopeMetadata</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method)]</AttributeName>
<AttributeName Language="F#">[<System.AttributeUsage(System.AttributeTargets.Class | System.AttributeTargets.Method)>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>
This attribute is used on a controller, pages, or controller actions
to declare (and validate) the scopes required by a web API. These scopes can be declared
in two ways: hardcoding them, or declaring them in the configuration. Depending on your
choice, use either one or the other of the constructors.
For details, see https://aka.ms/ms-id-web/required-scope-attribute.
</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public RequiredScopeAttribute ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Identity.Web.Resource.RequiredScopeAttribute.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>
Default constructor.
</summary>
<remarks>To be added.</remarks>
<example>
<code>
[RequiredScope(RequiredScopesConfigurationKey="AzureAD:Scope")]
class Controller : BaseController
{
}
</code>
</example>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public RequiredScopeAttribute (params string[] acceptedScopes);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string[] acceptedScopes) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Identity.Web.Resource.RequiredScopeAttribute.#ctor(System.String[])" />
<MemberSignature Language="VB.NET" Value="Public Sub New (ParamArray acceptedScopes As String())" />
<MemberSignature Language="F#" Value="new Microsoft.Identity.Web.Resource.RequiredScopeAttribute : string[] -> Microsoft.Identity.Web.Resource.RequiredScopeAttribute" Usage="new Microsoft.Identity.Web.Resource.RequiredScopeAttribute acceptedScopes" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.0.1.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="acceptedScopes" Type="System.String[]">
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ParamArray]</AttributeName>
<AttributeName Language="F#">[<System.ParamArray>]</AttributeName>
</Attribute>
</Attributes>
</Parameter>
</Parameters>
<Docs>
<param name="acceptedScopes">Scopes accepted by this web API.</param>
<summary>
Verifies that the web API is called with the right scopes.
If the token obtained for this API is on behalf of the authenticated user does not have
any of these <paramref name="acceptedScopes" /> in its scope claim, the
method updates the HTTP response providing a status code 403 (Forbidden)
and writes to the response body a message telling which scopes are expected in the token.
</summary>
<remarks>When the scopes don't match, the response is a 403 (Forbidden),
because the user is authenticated (hence not 401), but not authorized.</remarks>
<example>
Add the following attribute on the controller/page/action to protect:
<code>
[RequiredScope("access_as_user")]
</code></example>
<altmember cref="M:RequiredScopeAttribute()" />
<see cref="P:Microsoft.Identity.Web.Resource.RequiredScopeAttribute.RequiredScopesConfigurationKey" />
</Docs>
</Member>
<Member MemberName="AcceptedScope">
<MemberSignature Language="C#" Value="public string[]? AcceptedScope { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string[] AcceptedScope" />
<MemberSignature Language="DocId" Value="P:Microsoft.Identity.Web.Resource.RequiredScopeAttribute.AcceptedScope" />
<MemberSignature Language="VB.NET" Value="Public Property AcceptedScope As String()" />
<MemberSignature Language="F#" Value="member this.AcceptedScope : string[] with get, set" Usage="Microsoft.Identity.Web.Resource.RequiredScopeAttribute.AcceptedScope" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Docs>
<summary>
Scopes accepted by this web API.
</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="IsReusable">
<MemberSignature Language="C#" Value="public bool IsReusable { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance bool IsReusable" />
<MemberSignature Language="DocId" Value="P:Microsoft.Identity.Web.Resource.RequiredScopeAttribute.IsReusable" />
<MemberSignature Language="VB.NET" Value="Public Property IsReusable As Boolean" />
<MemberSignature Language="F#" Value="member this.IsReusable : bool with get, set" Usage="Microsoft.Identity.Web.Resource.RequiredScopeAttribute.IsReusable" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.Boolean</ReturnType>
</ReturnValue>
<Docs>
<summary>
Unused: Compatibility of interface with the Authorization Filter.
</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
</Docs>
</Member>
<Member MemberName="RequiredScopesConfigurationKey">
<MemberSignature Language="C#" Value="public string? RequiredScopesConfigurationKey { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string RequiredScopesConfigurationKey" />
<MemberSignature Language="DocId" Value="P:Microsoft.Identity.Web.Resource.RequiredScopeAttribute.RequiredScopesConfigurationKey" />
<MemberSignature Language="VB.NET" Value="Public Property RequiredScopesConfigurationKey As String" />
<MemberSignature Language="F#" Value="member this.RequiredScopesConfigurationKey : string with get, set" Usage="Microsoft.Identity.Web.Resource.RequiredScopeAttribute.RequiredScopesConfigurationKey" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.0.1.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>
Fully qualified name of the configuration key containing the required scopes (separated
by spaces).
</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
<example>
If the appsettings.json file contains a section named "AzureAd", in which
a property named "Scopes" contains the required scopes, the attribute on the
controller/page/action to protect should be set to the following:
<code>
[RequiredScope(RequiredScopesConfigurationKey="AzureAd:Scopes")]
</code></example>
</Docs>
</Member>
</Members>
</Type>