dotnet-api-security

Implement authentication, authorization, and security policies for ASP.NET Core APIs.

1|Updated Feb 22, 2026
One-click install
npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-api-security-rudironsoni
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dotnet-api-security
Source: https://github.com/rudironsoni/dotnet-agent-harness/tree/main/.rulesync/skills/dotnet-api-security
Command: npx skills add https://github.com/rudironsoni/dotnet-agent-harness --skill dotnet-api-security-rudironsoni

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides comprehensive guidance and implementation patterns for securing ASP.NET Core APIs against common threats, ensuring data integrity and user privacy.

Core Features & Use Cases

  • Authentication: Implement robust user authentication using ASP.NET Core Identity, OAuth/OIDC, and JWT bearer tokens.
  • Authorization: Define granular access control policies based on roles and claims.
  • Security Best Practices: Configure CORS, Content Security Policy (CSP), and rate limiting to mitigate attacks.
  • Use Case: Secure a new REST API endpoint that requires users to be authenticated and authorized as 'Admins' before they can perform sensitive operations.

Quick Start

Configure JWT bearer token authentication for your ASP.NET Core API by adding the necessary services and middleware.

Frequently Asked Questions about dotnet-api-security

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

FAQPage Schema
How do I configure JWT bearer token authentication in ASP.NET Core?

Configure JWT bearer token authentication in ASP.NET Core by adding the necessary authentication services and middleware to your API pipeline, validating tokens for secure user access. This handles token verification and establishes user identity for subsequent requests.

What is the best way to implement role and claim-based authorization in an ASP.NET Core API?

Role and claim-based authorization in an ASP.NET Core API is implemented by defining granular access control policies. This restricts sensitive endpoint operations, ensuring only authenticated users with specific Admin roles or claims can execute them.

How does OAuth and OIDC integration work for securing ASP.NET Core APIs?

OAuth and OIDC integration secures ASP.NET Core APIs by delegating user authentication to an external identity provider. This issues access tokens that your API validates, establishing robust user identity without managing credentials directly.

How do I set up rate limiting and CORS policies for an ASP.NET Core API?

Set up rate limiting and CORS policies in ASP.NET Core by configuring security middleware. This mitigates attacks by controlling request frequency from clients and restricting cross-origin resource sharing to trusted domains only.

Can I use passkey authentication with ASP.NET Core Identity?

Yes, passkey authentication is supported alongside ASP.NET Core Identity, JWT, and OAuth. This modern authentication mechanism enhances user privacy and secures API endpoints against common credential-based threats.

Why do I need Content Security Policy headers for my ASP.NET Core API?

Content Security Policy headers are needed for ASP.NET Core APIs to mitigate cross-site scripting and data injection attacks. Configuring CSP adds a security layer that restricts resource loading to trusted sources.