class

AspnetAuthTagger

Inherits FrameworkTagger < FileHelper < Tagger < Reference < Object

Constants

ACTION_AUTH_PATTERNS = [{/User\.Identity\.IsAuthenticated/, "ASP.NET User.Identity.IsAuthenticated"}, {/User\.IsInRole\s*\(/, "ASP.NET User.IsInRole check"}, {/HttpContext\.User/, "ASP.NET HttpContext.User check"}]

ASP.NET Core middleware auth in action body

ALLOW_ANONYMOUS_PATTERN = /\[AllowAnonymous\]/

Public override markers

AUTHORIZE_PATTERNS = [{/\[Authorize\]/, "ASP.NET [Authorize]"}, {/\[Authorize\s*\(\s*Roles\s*=/, "ASP.NET [Authorize(Roles)]"}, {/\[Authorize\s*\(\s*Policy\s*=/, "ASP.NET [Authorize(Policy)]"}, {/\[Authorize\s*\(\s*AuthenticationSchemes\s*=/, "ASP.NET [Authorize(AuthenticationSchemes)]"}]

ASP.NET [Authorize] attribute patterns

MINIMAL_API_ALLOW_ANON = /\.AllowAnonymous\s*\(/
MINIMAL_API_REQUIRE_AUTH = /\.RequireAuthorization\s*\(/

Minimal API fluent auth: app.MapGet("/x", h).RequireAuthorization();. This is a chained method call, never a [...] attribute, so it can't live in AUTHORIZE_PATTERNS (which is scanned in attribute position).

Class methods

target_techs
Source