RicoSuter/NSwag

OperationSecurityScopeProcessor ignores AllowAnonymousAttribute

Open

#1,195 opened on Feb 15, 2018

View on GitHub
 (2 comments) (0 reactions) (0 assignees)C# (1,189 forks)batch import
help wantedtype: enhancement

Repository metrics

Stars
 (6,291 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

OperationSecurityScopeProcessor currently only looks for AuthorizeAttribute but ignores AllowAnonymousAttribute which is designed to override AuthorizeAttribute when both are declared.

So it is valid to declare AuthorizeAttribute on the entire controller and opt-out on single actions using AllowAnonymousAttribute. It's even valid to declare AuthorizeAttribute on a base controller type and AllowAnonymousAttribute on a derived controller type.

Contributor guide