authentication

Implement JWT and cookie authentication with policy-based authorization in ASP.NET Core.

1|Updated Apr 28, 2026
One-click install
npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill authentication-trossitec
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: authentication
Source: https://github.com/Trossitec/dotnet-claude-kit/tree/main/skills/authentication
Command: npx skills add https://github.com/Trossitec/dotnet-claude-kit --skill authentication-trossitec

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you implement correct authentication and authorization in ASP.NET Core without fragile, insecure, or hard-to-maintain patterns that break access control or mishandle tokens and secrets.

Core Features & Use Cases

  • JWT and cookie authentication guidance: Choose the right scheme for APIs (Bearer/JWT) versus web apps (cookies) and configure token validation properly.
  • Policy-based authorization design: Replace role-string checks with composable, testable authorization policies, including custom requirements/handlers.
  • Authorization for real endpoints: Protect endpoint groups and individual routes while allowing explicit anonymous access where needed.
  • Identity and external login patterns: Use ASP.NET Identity for user management and configure OpenID Connect for external identity providers.

Quick Start

Load the authentication skill, then ask an AI to propose a complete ASP.NET Core auth setup for your scenario (API vs web app) using JWT or cookies, policy-based authorization, and safe secret handling.

Frequently Asked Questions about authentication

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure JWT Bearer authentication in ASP.NET Core to validate issuer, audience, and signing keys?

JWT Bearer authentication in ASP.NET Core validates tokens by checking the issuer, audience, lifetime, and signing key. This Skill configures API protection to prevent insecure access control and ensure correct token handling for protected routes.

What is the best way to implement policy-based authorization instead of hard-coded role strings in ASP.NET Core?

Policy-based authorization replaces hard-coded role checks with composable, testable policies using custom requirements and handlers. This approach secures endpoints in ASP.NET Core while maintaining flexible access control for APIs and web apps.

Does this authentication approach support both minimal APIs and controllers in ASP.NET Core?

Yes, endpoint authorization wiring applies to both minimal APIs and controllers in ASP.NET Core. You can protect endpoint groups and individual routes while explicitly allowing anonymous access where needed.

How do I set up OpenID Connect for external identity providers with ASP.NET Identity?

OpenID Connect integration configures external identity providers alongside ASP.NET Identity for user management. This Skill guides external login patterns to secure ASP.NET Core applications without fragile or insecure access control.

When should I use cookie authentication versus JWT Bearer tokens in ASP.NET Core?

Cookie authentication suits web apps while JWT Bearer tokens protect APIs in ASP.NET Core. This Skill helps choose the right scheme and configure token validation properly to prevent incorrect token handling.

How do I securely manage secrets and signing keys for JWT validation in ASP.NET Core?

Secure secret management protects signing keys used for JWT validation in ASP.NET Core. This Skill ensures safe handling of authentication secrets to prevent insecure access control and incorrect token validation.