# dotnet-api-security

dotnet-api-security is a Claude Code skill that handles authentication and authorization in ASP.NET Core APIs.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode, Windsurf (Devin Desktop), Claude.ai · 169 installs · ★ 92 repo stars
- Author: wshaddix
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/wshaddix/dotnet-skills/tree/HEAD/skills/dotnet-api-security/SKILL.md
- Updated: 2026-02-27
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/skills/dotnet-api-security

## What it does

The skill takes ownership of the API security layer in ASP.NET Core: Identity setup with password rules and account lockout, external provider integration via OAuth 2.0/OIDC (Entra ID, Auth0, Okta, Keycloak), JWT bearer validation with policy-based authorization, Content Security Policy headers, and CORS configuration.

Passkey support through WebAuthn is also covered — the skill knows the full .NET 10 flow from generating a `PublicKeyCredentialCreationOptions` challenge to verifying the assertion server-side. Fallback authorization policies via `AddAuthorizationBuilder` are part of the same scope.

The boundaries are explicit: OWASP Top 10 mitigations belong to `dotnet-security-owasp`, secrets management to `dotnet-secrets-management`, and Blazor auth components (`AuthorizeView`, `CascadingAuthenticationState`) to a separate skill. If you combine multiple skills from `wshaddix/dotnet-skills` in one project, knowing these lines prevents overlap.

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-api-security -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/dotnet-api-security/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/dotnet-api-security/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-api-security -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/dotnet-api-security/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-api-security -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/dotnet-api-security/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install wshaddix/dotnet-skills skills/dotnet-api-security
```

2. **Manually: put the files in place**
- File: `.github/skills/dotnet-api-security/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-api-security -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/wshaddix/dotnet-skills --path skills/dotnet-api-security
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/dotnet-api-security/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add wshaddix/dotnet-skills --skill dotnet-api-security -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/wshaddix/dotnet-skills/tree/HEAD/skills/dotnet-api-security/SKILL.md

## When to use it
- Configure JWT bearer authentication with custom authorization policies
- Wire up OAuth 2.0/OIDC against Entra ID, Auth0, or Keycloak
- Add passwordless passkey (WebAuthn) login in a .NET 10 project
- Set up ASP.NET Core Identity with lockout and two-factor authentication
- Apply CORS policies and rate limiting to a public-facing API

## Example prompts
- Add JWT bearer auth to the `/api/orders` endpoint and require the `PremiumUser` policy
- Connect OIDC via Keycloak, save tokens, and pull claims from the userinfo endpoint
- Enable passkeys with `AddPasskeys()` and walk through the registration flow for an SPA client

## Similar
- [authentication](https://affpapa.org/en/nevibecode/skills/codewithmukesh-authentication.md) — skill · 4000 installs
- [api-security-hardening](https://affpapa.org/en/nevibecode/skills/api-security-hardening.md) — skill · 872 installs
- [dotnet-security](https://affpapa.org/en/nevibecode/skills/dotnet-security.md) — skill · 358 installs
- [dotnet-backend](https://affpapa.org/en/nevibecode/skills/dotnet-backend.md) — skill · 267 installs
- [dotnet-core-expert](https://affpapa.org/en/nevibecode/skills/dotnet-core-expert.md) — skill · 5100 installs
- [cloudflare-workers-security](https://affpapa.org/en/nevibecode/skills/cloudflare-workers-security.md) — skill · 389 installs

From the same set: [wshaddix/dotnet-skills](https://affpapa.org/en/nevibecode/by/wshaddix/dotnet-skills.md) — 24 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
