Add a `Scope` property to the `Authorize` attribute
Open
api-suggestion
area-auth
enhancement
- Dominant language
- C#
- Stars
- 38.4k
- Forks
- 10.9k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 281
Description
## Background and Motivation
Make it easy to restrict access to a resource to authenticated users carrying a scope in their claims.
## Proposed API
```diff
namespace Microsoft.AspNetCore.Authorization;
public class AuthorizeAttribute : Attribute, Microsoft.AspNetCore.Authorization.IAuthorizeData
{
+ ///
+ /// Gets or sets the scope name that determines access to the resource.
+ ///
+ public string? Scope { get; set; }
}
```
## Usage Examples
```csharp
[Authorize(Scope = "read:project")]
public class HomeController : Controller
{
}
```
Contributor guide
Assessment
This issue has not been assessed yet.