You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Title: "New Project: Required Controller Auth Analyzer"
2
+
Published: 2025/06/09
3
+
Tags:
4
+
- Project
5
+
- C#
6
+
- Roslyn Analyzer
7
+
---
8
+
9
+
## New Project: Required Controller Auth Analyzer
10
+
11
+
A few months ago I created a C# Roslyn Analyzer to scan ASP.NET endpoints and add a compiler warning if an endpoint didn't have auth specified with an attribute ([Authorize] or [AllowAnonymous]) or some other way. [The old post is here](/posts/20250209_RequiredAuthRoslynAnalyzer)
12
+
13
+
Requiring it on each endpoint is a bit strict. Some people prefer to only require it at the controller level. So now I've created a new Roslyn Analyzer for just that. It will add a compiler warning if there are no Auth attributes at either the Controller level, OR the individual endpoints.
14
+
15
+
The full details are in the project README at: https://github.com/ProgrammerAL/required-auth.controller.analyzer
16
+
17
+
## NuGet Package
18
+
19
+
The NuGet package is hosted on nuget.org. You can get it from: https://www.nuget.org/packages/ProgrammerAL.Analyzers.ControllerRequiredAuthAnalyzer
0 commit comments