codewithmukesh/dotnet-claude-kit/authentication
Claude Code and agent skill by codewithmukesh/dotnet-claude-kit
- community
Checking that the SKILL.md file is still in the repository.
Authentication and authorization for ASP.NET Core. Covers JWT bearer tokens, OpenID Connect, ASP.NET Identity, authorization policies, role and claim-based authorization, and API key authentication. Load this skill when implementing login, protecting endpoints, designing authorization rules, or when the user mentions "auth", "JWT", "bearer token", "OIDC", "OpenID Connect", "Identity", "claims", "roles", "authorize", "RequireAuthorization", "API key", or "cookie auth".
Install
npx vskill@latest install codewithmukesh/dotnet-claude-kit/authenticationSKILL.md
The same SKILL.md was published earlier as codewithmukesh/dotnet-claude-kit/authentication.
Authentication & Authorization
Core Principles
- Use ASP.NET Identity for user management — Don't build your own user store. Identity handles password hashing, lockout, two-factor, email confirmation, and (since .NET 10) built-in passkey/WebAuthn support for passwordless login.
- JWT for APIs, cookies for web apps — APIs use Bearer token authentication; Blazor/MVC apps use cookie authentication.
- Policy-based authorization over roles — Policies are testable, composable, and more expressive than
[Authorize(Roles = "Admin")]. - Never store secrets in code — Use user secrets in development, Azure Key Vault / environment variables in production.
Patterns
JWT Bearer Authentication
Token Generation
Use JsonWebTokenHandler from Microsoft.IdentityModel.JsonWebTokens — it is the maintained, span-based handler that ASP.NET Core itself validates with. JwtSecurityTokenHandler (System.IdentityModel.Tokens.Jwt) is the legacy stack.
Policy-Based Authorization
Protecting Endpoints
OpenID Connect (External Identity Provider)
Accessing Current User
Anti-patterns
Don't Use Role Strings Everywhere
Don't Store Secrets in appsettings.json
Don't Skip Token Validation
Decision Guide
| Scenario | Recommendation | |
|---|---|---|
| REST API | JWT Bearer authentication | |
| Blazor Server / MVC | Cookie authentication | |
| External identity provider | OpenID Connect | |
| User registration / login | ASP.NET Identity | |
| Passwordless login | ASP.NET Identity passkeys (WebAuthn, built-in since .NET 10) | |
| Permission checking | Policy-based authorization | |
| Multi-tenant API | Claims-based with tenant claim | |
| API-to-API communication | Client credentials (OAuth 2.0) | |
| Simple API keys | Custom AuthenticationHandler<T> |
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/authentication/SKILL.md
Popularity
- Repository stars
- 656
- Repository forks
- 150
- 7-day trend score
- 32
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/codewithmukesh/dotnet-claude-kit/authentication)