duendesoftware/duende-skills/identityserver-token-security
Claude Code and agent skill by duendesoftware/duende-skills
- community
Checking that the SKILL.md file is still in the repository.
Advanced token security features in Duende IdentityServer including DPoP, mTLS certificate binding, Pushed Authorization Requests (PAR), JWT Secured Authorization Requests (JAR), and FAPI 2.0 compliance configuration.
Install
npx vskill@latest install duendesoftware/duende-skills/identityserver-token-securitySKILL.md
The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver-token-security.
Advanced Token Security (DPoP, mTLS, PAR, JAR, FAPI)
When to Use This Skill
- Implementing Proof-of-Possession (PoP) tokens with DPoP or mTLS
- Configuring Pushed Authorization Requests (PAR) for front-channel parameter security
- Setting up JWT Secured Authorization Requests (JAR) for tamperproof authorize requests
- Building FAPI 2.0 compliant authorization servers
- Choosing between DPoP and mTLS for sender-constrained tokens
- Configuring APIs to validate proof-of-possession tokens
- Meeting regulatory or industry security requirements (open banking, e-health, e-government)
Docs: https://docs.duendesoftware.com/identityserver/tokens/
Proof-of-Possession Tokens: Why They Matter
Default OAuth access tokens are bearer tokens -- anyone who possesses the token can use it. If a token leaks, a malicious third party can impersonate the client/user.
Proof-of-Possession (PoP) tokens are cryptographically bound to the client that requested them via the cnf (confirmation) claim:
When using reference tokens, the cnf claim is returned from the introspection endpoint.
DPoP vs mTLS: Decision Matrix
| Factor | DPoP | mTLS | |
|---|---|---|---|
| Edition required | Enterprise | All editions (binding); Enterprise (some features) | |
| Minimum version | 6.3 | All versions | |
| Key management | Application-layer JWK (dynamic) | X.509 certificate (TLS layer) | |
| Infrastructure | No TLS changes needed | Requires TLS client certificate infrastructure | |
| Deployment complexity | Lower | Higher (certificate distribution, renewal) | |
| Protocol layer | HTTP headers (DPoP header) | TLS channel | |
| Public clients | Supported (mobile/SPA) | Harder for public clients | |
| FAPI 2.0 | Accepted | Accepted | |
| Replay protection | Nonce mechanism + iat validation | TLS channel binding | |
| Recommendation | Start here for most use cases | When TLS infrastructure already exists |
Mutual TLS (mTLS)
How It Works
IdentityServer embeds the SHA-256 thumbprint of the client's X.509 certificate into the access token via the cnf claim:
The client must use the same certificate when calling APIs. APIs validate the cnf claim against the TLS client certificate thumbprint.
mTLS for Client Authentication
Configure IdentityServer to accept client certificates:
Configure the client with certificate-based secrets:
Use SecretTypes.X509CertificateName for PKI/chained certificates (matched by distinguished name) and SecretTypes.X509CertificateThumbprint for self-issued certificates (matched by thumbprint).
mTLS Endpoint URL Strategies
options.MutualTls.DomainName controls where the mTLS-protected endpoints live:
DomainName value | Endpoint layout | Example | |
|---|---|---|---|
null / empty | Path-based on the main host | https://host/connect/mtls/token | |
"mtls" | Sub-domain | https://mtls.host/connect/token | |
| full domain | Separate dedicated domain | https://mtls.example.com/connect/token |
The mTLS endpoint URLs are published in discovery under mtls_endpoint_aliases. Clients must read them from there rather than the standard endpoints:
mTLS Deployment: Kestrel (dev) vs Reverse Proxy (production)
Development — Kestrel terminates TLS directly. Use mkcert to create a locally-trusted CA (the private key stays on your machine, unlike shared sample certificates that ship public private keys). Accept — but don't require — client certificates; IdentityServer's mTLS middleware enforces them on the mTLS endpoint:
On .NET 10, Kestrel auto-resolves*.localhostsub-domains, so themtls.localhostsub-domain strategy works locally with no hosts-file entry.
Production — a reverse proxy terminates TLS and forwards the client certificate to Kestrel via a request header. Kestrel itself does not negotiate the certificate (ClientCertificateMode.NoCertificate); use certificate forwarding:
Proxy header conventions:
| Proxy | Header | Value format | |
|---|---|---|---|
| IIS | X-ARR-ClientCert | base64 DER | |
| Nginx | X-SSL-CERT | $ssl_client_escaped_cert (URL-encoded PEM) | |
| Apache | X-SSL-CERT | %{SSL_CLIENT_CERT}s (PEM) |
Security: the proxy must strip or overwrite the certificate header on all inbound requests so a client cannot spoof a certificate by sending the header directly.
mTLS without Client Authentication
You can bind tokens to a client certificate without using the certificate for client authentication. This works with any authentication method, including public clients:
The client creates a certificate on the fly and uses it to establish the TLS channel:
.NET Client Requesting mTLS Token
Validating mTLS in APIs
Add custom middleware to compare the cnf claim against the TLS client certificate:
The middleware validates the x5t#S256 value in the cnf claim against the SHA-256 thumbprint of the client certificate on the TLS channel.
DPoP (Demonstrating Proof-of-Possession at the Application Layer)
Version: >= 6.3 (Enterprise Edition)
DPoP binds an asymmetric key (stored as a JWK) to an access token via the cnf claim:
The client proves possession of the private key by sending a signed JWT (proof token) via the DPoP HTTP header on every request.
Enabling DPoP in IdentityServer
DPoP can be used dynamically with no server configuration, or enforced per-client:
Client-Side DPoP Configuration
Use Duende.AccessTokenManagement for automatic DPoP proof token handling.
Client credentials flow:
Authorization code flow:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files.
- Model reviewNot runA model review is scheduled for the next rescan.
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/identityserver-token-security/SKILL.md
Popularity
- Repository stars
- 9
- Repository forks
- 3
- 7-day trend score
- 0
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/duendesoftware/duende-skills/identityserver-token-security)