What problem does it solve?
This Skill provides clear, production-oriented guidance to implement JSON Web Token authentication in .NET APIs so teams can securely issue, validate, and refresh tokens without leaking secrets or leaving refresh tokens vulnerable to reuse.
Core Features & Use Cases
- Short-lived access tokens and rotating refresh tokens to minimize the blast radius of token theft.
- Full validation of issuer, audience, lifetime, and signing key with reduced clock skew and configurable options.
- Token generation and rotation patterns including an ITokenService, refresh token repository, and login/refresh endpoints for Minimal APIs.
- Claims and current-user access via a dedicated ICurrentUserService for handlers and authorization decisions.
- Use Case: Add compliant JWT authentication to an existing .NET web API, centralize signing keys in secrets or Key Vault, and introduce refresh token rotation and revocation.
Quick Start
Configure JWT Bearer authentication in your .NET API using a JwtOptions configuration bound to user secrets or Key Vault, validate issuer/audience/lifetime/signing key, set a short access token expiry and 30 second clock skew, and implement refresh token rotation and storage.