identity-testing-patterns

Configure IdentityServer authentication and token workflow tests with WebApplicationFactory.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Integration tests for IdentityServer-based authentication and token workflows become repeatable, reliable, and isolated from live dependencies.

Core Features & Use Cases

  • Pattern-based guidance for WebApplicationFactory-based integration tests, mock token issuance, test authority configuration, and protocol validation.
  • Comprehensive coverage of IProfileService, authorization policies, BFF session scenarios, and Aspire full-stack testing.
  • Real-world examples and test strategies to accelerate validating token issuance, claims, and protected API access.

Quick Start

Set up an in-process IdentityServer test harness and begin validating token issuance, policy enforcement, and BFF flows with the provided patterns.

Frequently Asked Questions about identity-testing-patterns

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

FAQPage Schema
How do I test IdentityServer token workflows in integration tests?

You can test IdentityServer token workflows by applying pattern-based guidance with WebApplicationFactory to configure in-process test authorities, issue mock tokens, and validate protected API access.

What is the best way to mock token issuance for ASP.NET Core integration tests?

Mock token issuance is achieved by configuring test authorities with static signing keys, allowing you to generate and validate tokens safely without relying on live identity dependencies during integration tests.

Can I test BFF session scenarios and authorization policies using WebApplicationFactory?

Yes, you can test BFF session scenarios and authorization policies by setting up an in-process IdentityServer test harness that enforces test configuration patterns, claim handling, and policy testing across in-process APIs.

Does this testing approach support Aspire full-stack testing scenarios?

Yes, the testing patterns support Aspire full-stack scenarios, providing comprehensive coverage for validating token issuance, claims, and protected API access across distributed in-process APIs and token endpoints.

How do I configure static signing keys for safe token validation in test environments?

Safe token validation in test environments is configured using static signing keys and configurable test authorities, ensuring repeatable and isolated token validation without external dependencies.

Why do my integration tests for authentication fail when using live dependencies?

Integration tests fail with live dependencies because they lack isolation; applying test configuration patterns with mock token issuance and in-process authorities ensures reliable, repeatable authentication testing.