-
Notifications
You must be signed in to change notification settings - Fork 32
/
RequiredScopeOrAppPermissionAttribute.xml
241 lines (240 loc) Β· 13.6 KB
/
RequiredScopeOrAppPermissionAttribute.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
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
<Type Name="RequiredScopeOrAppPermissionAttribute" FullName="Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute">
<TypeSignature Language="C#" Value="public class RequiredScopeOrAppPermissionAttribute : Attribute, Microsoft.Identity.Web.IAuthRequiredScopeOrAppPermissionMetadata" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit RequiredScopeOrAppPermissionAttribute extends System.Attribute implements class Microsoft.Identity.Web.IAuthRequiredScopeOrAppPermissionMetadata" />
<TypeSignature Language="DocId" Value="T:Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute" />
<TypeSignature Language="VB.NET" Value="Public Class RequiredScopeOrAppPermissionAttribute
Inherits Attribute
Implements IAuthRequiredScopeOrAppPermissionMetadata" />
<TypeSignature Language="F#" Value="type RequiredScopeOrAppPermissionAttribute = class
 inherit Attribute
 interface IAuthRequiredScopeOrAppPermissionMetadata" />
<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>
<AssemblyVersion>3.1.0.0</AssemblyVersion>
<AssemblyVersion>3.2.0.0</AssemblyVersion>
<AssemblyVersion>3.2.1.0</AssemblyVersion>
<AssemblyVersion>3.2.2.0</AssemblyVersion>
<AssemblyVersion>3.3.0.0</AssemblyVersion>
<AssemblyVersion>3.3.1.0</AssemblyVersion>
<AssemblyVersion>3.4.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Attribute</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>Microsoft.Identity.Web.IAuthRequiredScopeOrAppPermissionMetadata</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 or app permissions required by a web API.
These scopes or app permissions 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-or-app-permissions-attribute.
</summary>
<remarks>To be added.</remarks>
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public RequiredScopeOrAppPermissionAttribute ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.4.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters />
<Docs>
<summary>
Default constructor.
</summary>
<remarks>To be added.</remarks>
<example>
<code>
[RequiredScopeOrAppPermission(RequiredScopesConfigurationKey="AzureAD:Scope", RequiredAppPermissionsConfigurationKey="AzureAD:AppPermission")]
class Controller : BaseController
{
}
</code>
</example>
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public RequiredScopeOrAppPermissionAttribute (string[] acceptedScopes, string[] acceptedAppPermissions);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor(string[] acceptedScopes, string[] acceptedAppPermissions) cil managed" />
<MemberSignature Language="DocId" Value="M:Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute.#ctor(System.String[],System.String[])" />
<MemberSignature Language="VB.NET" Value="Public Sub New (acceptedScopes As String(), acceptedAppPermissions As String())" />
<MemberSignature Language="F#" Value="new Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute : string[] * string[] -> Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute" Usage="new Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute (acceptedScopes, acceptedAppPermissions)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.4.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="acceptedScopes" Type="System.String[]" />
<Parameter Name="acceptedAppPermissions" Type="System.String[]" />
</Parameters>
<Docs>
<param name="acceptedScopes">Scopes accepted by this web API.</param>
<param name="acceptedAppPermissions">App permissions accepted by this web API.</param>
<summary>
Verifies that the web API is called with the right app permissions.
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,
nor <paramref name="acceptedAppPermissions" /> in its roles 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 neither the scopes nor app permissions 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>
[RequiredScopeOrAppPermission(new [] { "access_as_user" }, new [] { "access_as_app" })]
</code></example>
<altmember cref="M:RequiredScopeOrAppPermissionAttribute()" />
<see cref="P:Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute.RequiredAppPermissionsConfigurationKey" />
</Docs>
</Member>
<Member MemberName="AcceptedAppPermission">
<MemberSignature Language="C#" Value="public string[]? AcceptedAppPermission { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string[] AcceptedAppPermission" />
<MemberSignature Language="DocId" Value="P:Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute.AcceptedAppPermission" />
<MemberSignature Language="VB.NET" Value="Public Property AcceptedAppPermission As String()" />
<MemberSignature Language="F#" Value="member this.AcceptedAppPermission : string[] with get, set" Usage="Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute.AcceptedAppPermission" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.4.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String[]</ReturnType>
</ReturnValue>
<Docs>
<summary>
App permissions accepted by this web API.
App permissions appear in the roles claim of the token.
</summary>
<value>To be added.</value>
<remarks>To be added.</remarks>
</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.RequiredScopeOrAppPermissionAttribute.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.RequiredScopeOrAppPermissionAttribute.AcceptedScope" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.4.0.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="RequiredAppPermissionsConfigurationKey">
<MemberSignature Language="C#" Value="public string? RequiredAppPermissionsConfigurationKey { get; set; }" />
<MemberSignature Language="ILAsm" Value=".property instance string RequiredAppPermissionsConfigurationKey" />
<MemberSignature Language="DocId" Value="P:Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute.RequiredAppPermissionsConfigurationKey" />
<MemberSignature Language="VB.NET" Value="Public Property RequiredAppPermissionsConfigurationKey As String" />
<MemberSignature Language="F#" Value="member this.RequiredAppPermissionsConfigurationKey : string with get, set" Usage="Microsoft.Identity.Web.Resource.RequiredScopeOrAppPermissionAttribute.RequiredAppPermissionsConfigurationKey" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.4.0.0</AssemblyVersion>
</AssemblyInfo>
<ReturnValue>
<ReturnType>System.String</ReturnType>
</ReturnValue>
<Docs>
<summary>
Fully qualified name of the configuration key containing the required app permissions (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 "AppPermissions" contains the required app permissions, the attribute on the
controller/page/action to protect should be set to the following:
<code>
[RequiredScopeOrAppPermission(RequiredAppPermissionsConfigurationKey="AzureAd:AppPermissions")]
</code></example>
</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.RequiredScopeOrAppPermissionAttribute.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.RequiredScopeOrAppPermissionAttribute.RequiredScopesConfigurationKey" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Microsoft.Identity.Web</AssemblyName>
<AssemblyVersion>3.4.0.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>
[RequiredScopeOrAppPermission(RequiredScopesConfigurationKey="AzureAd:Scopes")]
</code></example>
</Docs>
</Member>
</Members>
</Type>