Skip to content
A [RequireClaim()] Authorization Attribute for Asp.Net Core
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.md
RequireClaimAttribute.cs
RequireClaimAttributeAuthorization.csproj

README.md

[RequireClaim()] Attribute for AspNetCore

AspNet Core has simpled Attribute-based, declarative authorization for Roles and Policies but not for Claims. This project adds authorization for Claims using the "expected" Attribute-based syntax. The attribute inherits from AuthorizeAttribute and can be applied to Controller or to Action.

    [RequireClaim("AClaimType",Value = "RequiredValue")]
    public IActionResult Action(){}

    [RequireClaim("AClaimType")]
    public IActionResult Action(){}

#Usage In Startup.cs:

    public void ConfigureServices(IServiceCollection services)
    {
        services.AddMvc();
        services.AddRequireClaimAttributeAuthorization();
    }
You can’t perform that action at this time.