identityserver-api-protection

Validate IdentityServer JWT and reference tokens with scope-based authorization.

10|2|Updated Mar 16, 2026
One-click install
npx skills add https://github.com/DuendeSoftware/duende-skills --skill identityserver-api-protection
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: identityserver-api-protection
Source: https://github.com/DuendeSoftware/duende-skills/tree/main/skills/identityserver-api-protection
Command: npx skills add https://github.com/DuendeSoftware/duende-skills --skill identityserver-api-protection

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Protecting APIs with IdentityServer involves validating access tokens, supporting both JWTs and reference tokens, enforcing scopes, and applying PoP to guard against token theft across multi-audience deployments.

Core Features & Use Cases

  • JWT Bearer Authentication: Validate JWT access tokens with issuer authority and proper type filtering (at+jwt) to prevent token confusion.
  • Reference Token Introspection: Use OAuth2 introspection for opaque tokens and ensure ApiSecrets are configured for secure introspection.
  • Handling Both JWT and Reference Tokens: Unified API token handling by forwarding reference tokens to an introspection endpoint while validating JWTs locally.
  • Scope-Based Authorization: Implement policies based on token scopes to enforce fine-grained access control across resources.
  • Proof-of-Possession (PoP): Validate PoP tokens via mTLS cnf and DPoP proof to bind tokens to clients and requests.
  • Local API Authentication: Support co-hosted IdentityServer APIs with local API authentication for reduced latency.
  • Multi-Audience APIs: Support multiple API resources by validating multiple audiences.

Quick Start

Configure your API to validate JWTs, enable reference token introspection when using opaque tokens, and implement PoP (mTLS/DPoP) as described.

Frequently Asked Questions about identityserver-api-protection

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

FAQPage Schema
How do I validate JWT access tokens in ASP.NET Core APIs to prevent token confusion?

To validate JWT access tokens in ASP.NET Core APIs, configure JwtBearer authentication with ValidTypes = ["at+jwt"] to enforce proper type filtering and prevent token confusion. This ensures your API only accepts correctly typed bearer tokens issued by the expected authority.

How do I handle both reference tokens and JWTs in the same API endpoint?

Handle both reference tokens and JWTs by forwarding opaque tokens to an OAuth2 introspection endpoint using AddOAuth2Introspection, while validating JWTs locally. Ensure ApiSecrets are configured for secure introspection to enable unified API token handling.

What is Proof-of-Possession (PoP) validation for OAuth2 tokens and when do I need it?

Proof-of-Possession (PoP) validation binds tokens to specific clients and requests to guard against token theft across multi-audience deployments. You need PoP validation when securing APIs with mTLS cnf or DPoP proof, requiring setup with a distributed cache.

How do I implement scope-based authorization for API resources using IdentityServer?

Implement scope-based authorization for API resources by creating policies based on token scopes to enforce fine-grained access control. This allows your ASP.NET Core API to restrict access to specific resources based on the scopes granted in the IdentityServer token.

Can I use local API authentication for co-hosted IdentityServer deployments to reduce latency?

Yes, you can use local API authentication for co-hosted IdentityServer APIs to reduce latency. This approach supports co-hosted deployments by validating tokens locally without requiring external network calls, providing faster authentication for your integrated APIs.

How do I support multiple audiences in APIs validating IdentityServer tokens?

Support multiple API resources and audiences by validating multiple audiences within your JWT bearer authentication configuration. This enables a single API to securely accept tokens intended for different API resources issued by IdentityServer.