duendesoftware/duende-skills/identityserver-saml

Claude Code and agent skill by duendesoftware/duende-skills

Trust tier 2
  • community
  • ext:[{"type":"plugin","description":"Custom plugin integration"}]
LLM review pending
Source check pending

Checking that the SKILL.md file is still in the repository.

Configuring Duende IdentityServer as a SAML 2.0 Identity Provider (IdP): service provider registration, SSO and SLO flows, claim mappings, extensibility interfaces, and production deployment patterns.

Install

npx vskill@latest install duendesoftware/duende-skills/identityserver-saml

Semi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard

SKILL.md

The same SKILL.md was published earlier as duendesoftware/duende-skills/identityserver-saml.

SAML 2.0 Identity Provider

When to Use This Skill

  • Setting up IdentityServer as a SAML 2.0 Identity Provider (IdP)
  • Registering SAML Service Providers with the SamlServiceProvider model
  • Configuring SP-initiated SSO and Single Logout (SLO) flows
  • Customizing claim-to-attribute mappings via ClaimMappings or extensibility interfaces
  • Implementing production SP stores (EF Core, custom ISamlServiceProviderStore)
  • Extending SAML behavior (custom NameID generation, signing, metadata, multi-tenant issuer)
  • Linking an external SAML IdP as a federated authentication source (SP mode)

Core Principles

  • SAML 2.0 IdP support is built into Duende.IdentityServer (v8.0+) — no separate NuGet package
  • Requires Standard (add-on), Advanced, or Custom Edition license
  • SP-initiated SSO is the default; IdP-initiated SSO is opt-in per service provider
  • SignAssertion is the default signing behavior; SignResponse is recommended for most deployments
  • Use EF Core stores for service providers in production; in-memory is for development only
  • Front-channel SLO uses iframes (not redirect chains); partial logout is expected behavior
  • The claim pipeline flows: AllowedScopes → RequestedClaimTypes → ClaimMappings

Docs: https://docs.duendesoftware.com/identityserver/saml

Setup

csharp
builder.Services.AddIdentityServer()
.AddInMemoryClients(Config.Clients)
.AddInMemoryIdentityResources(Config.IdentityResources)
.AddSaml()
.AddInMemorySamlServiceProviders(Config.SamlServiceProviders);

Update the login page to call DenyAuthenticationAsync for SAML cancellation support (when user cancels login during a SAML flow).

Endpoints

EndpointPathPurpose
Metadata/Saml2IdP metadata (certificates, endpoints, NameID formats)
Sign-in/Saml2/SSOReceives AuthnRequest (GET/POST)
Sign-in Callback/Saml2/SSO/CallbackBuilds SAML Response after authentication
Logout/Saml2/SLOHandles LogoutRequest/LogoutResponse
Logout Callback/Saml2/SLO/CallbackCompletes SLO round-trip

Paths are customizable via SamlOptions.Endpoints.

Profile Active Check

IProfileService.IsActiveAsync is called on every SSO request, including when the user already has an active session. If IsActive returns false: passive requests (IsPassive=true) receive a SAML NoPassive error response; all other requests are redirected to the login page. This is the recommended mechanism for blocking disabled or locked accounts without waiting for session expiry.

Observability

All SAML endpoints emit audit events and OpenTelemetry telemetry counters. SSO and SLO endpoints participate in distributed tracing via the Duende.IdentityServer activity source. See docs for SAML audit events and TelemetryMetricsCounters.SamlSso.

SamlServiceProvider Model

csharp
new SamlServiceProvider
{
// Required
EntityId = "https://sp.example.com",
DisplayName = "Example SP",
// ACS endpoints (HTTP-POST only, indexed)
AssertionConsumerServiceUrls =
[
new IndexedEndpoint
{
Location = "https://sp.example.com/acs",
Binding = SamlBinding.HttpPost,
Index = 0,
IsDefault = true
}
],
// Single Logout (HTTP-Redirect only)
SingleLogoutServiceUrls =
[
new SamlEndpointType
{
Location = "https://sp.example.com/saml/slo",
Binding = SamlBinding.HttpRedirect
}
],
// Security
SigningBehavior = SamlSigningBehavior.SignAssertion,
RequireSignedAuthnRequests = true,
Certificates =
[
new ServiceProviderCertificate
{
Certificate = spCert,
Use = KeyUse.Signing
}
],
// Claims (identity resources the SP can access)
AllowedScopes = ["openid", "profile", "email"],
RequestedClaimTypes = ["email", "name"], // optional narrowing
ClaimMappings = new Dictionary<string, string>
{
["email"] = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
["name"] = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name"
},
// NameID
DefaultNameIdFormat = SamlNameIdFormat.EmailAddress,
// IdP-Initiated SSO (opt-in)
AllowIdpInitiated = false,
// Lifecycle / display
Enabled = true, // false → reject all requests from this SP
Description = "Optional notes", // human-readable, not sent in SAML responses
// Per-SP overrides (null = fall back to SamlOptions global default)
AssertionLifetime = TimeSpan.FromMinutes(5), // overrides SamlOptions.DefaultAssertionLifetime
EmailNameIdClaimType = "email", // overrides SamlOptions.EmailNameIdClaimType
RequireSignedLogoutResponses = true, // overrides SamlOptions.RequireSignedLogoutResponses
AllowedSignatureAlgorithms = ["http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"], // null → IdP default
AuthnContextMappings = new Dictionary<string, string> // overrides SamlOptions.DefaultAuthnContextMappings
{
["pwd"] = "urn:oasis:names:tc:SAML:2.0:ac:classes:Password",
["mfa"] = "urn:oasis:names:tc:SAML:2.0:ac:classes:MobileTwoFactorContract"
}
}
Claim Pipeline
AllowedScopes (identity resources) → filters available claim types
↓
RequestedClaimTypes (optional narrowing) → selects specific claims
↓
ClaimMappings (OIDC claim name → SAML attribute URI) → output as <saml:Attribute>

Use SamlOptions.DefaultClaimMappings for global defaults; per-SP ClaimMappings override them.

Configuration (SamlOptions)

csharp
builder.Services.AddIdentityServer()
.AddSaml(saml =>
{
saml.EntityId = "https://idp.example.com/Saml2"; // default: {host}/Saml2
saml.EntityIdPath = "/Saml2"; // path appended to host URL to form default EntityId
saml.WantAuthnRequestsSigned = true; // default: true
saml.RequireSignedLogoutResponses = true; // default: true
saml.DefaultSigningBehavior = SamlSigningBehavior.SignAssertion;
saml.DefaultClockSkew = TimeSpan.FromMinutes(5);
saml.DefaultRequestMaxAge = TimeSpan.FromMinutes(5);
saml.DefaultAssertionLifetime = TimeSpan.FromMinutes(5);
saml.SupportedNameIdFormats = [SamlNameIdFormat.EmailAddress, SamlNameIdFormat.Unspecified];
saml.MaxRelayStateLength = 80; // SAML spec requirement
saml.MaxMessageSize = 1_048_576; // max chars of inbound SAML messages (default: 1 MB)
// Session/state lifetimes
saml.SigninStateLifetime = TimeSpan.FromMinutes(15); // how long sign-in request state is retained
saml.LogoutSessionLifetime = TimeSpan.FromMinutes(5); // how long SLO session tracking state is retained
// NameID claim type for email-format NameIDs (default: "email")
saml.EmailNameIdClaimType = "email";
// Global claim mappings
saml.DefaultClaimMappings = new Dictionary<string, string>
{
["name"] = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name",
["email"] = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress",
["role"] = "http://schemas.xmlsoap.org/ws/2005/05/identity/role"
};
// AuthnContext mappings (acr/amr → SAML AuthnContext URIs)
saml.DefaultAuthnContextMappings = new Dictionary<string, string>
{
["pwd"] = "urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport"
};
// Optional error inspector callbacks for debugging interoperability issues
// These can inspect or suppress parse errors on inbound SAML messages
saml.AuthnRequestErrorInspector = (context, exception) => { /* inspect/suppress */ };
saml.LogoutRequestErrorInspector = (context, exception) => { /* inspect/suppress */ };
saml.LogoutResponseErrorInspector = (context, exception) => { /* inspect/suppress */ };
});
Metadata Options
csharp
builder.Services.AddIdentityServer()
.AddSaml(saml =>
{
saml.Metadata.CacheDuration = TimeSpan.FromHours(12);
saml.Metadata.ExpiryDuration = TimeSpan.FromDays(5);
});
Endpoint Options
PropertyDefaultDescription
SingleSignOnServicePath"/Saml2/SSO"Path for the SSO endpoint
SingleSignOnServiceBindings[HttpRedirect, HttpPost]Bindings advertised in metadata (not which the endpoint accepts)
SingleSignOnCallbackPath"/Saml2/SSO/Callback"Internal callback path after user authenticates
SingleLogoutServicePath"/Saml2/SLO"Path for the SLO endpoint
SingleLogoutServiceBindings[HttpRedirect, HttpPost]Bindings advertised in metadata for SLO
SingleLogoutCallbackPath"/Saml2/SLO/Callback"Internal callback path for SLO completion
StateIdParameterName"samlStateId"Query string param name for the SAML sign-in state ID
csharp
builder.Services.AddIdentityServer()
.AddSaml(saml =>
{
saml.Endpoints.SingleSignOnServicePath = "/Saml2/SSO";
saml.Endpoints.SingleLogoutServicePath = "/Saml2/SLO";
});

SAML Signing Keys (X.509)

SAML signing requires an X.509 certificate. OIDC and SAML share the same signing credentials; rotation timing is governed by Automatic Key Management PropagationTime and RetentionDuration.

  • Automatic Key Management (RSA): auto-generated RSA keys are auto-wrapped into a self-signed X.509 container. You do not need UseX509Certificate just to enable SAML.
  • Manual / raw RSA keys — including `AddDeveloperSigningCredential()`: cannot be auto-wrapped. Register an X.509 certificate with a private key instead.
  • Cloud KMS / remote signing keys registered for OIDC through a custom ITokenCreationService do not cover SAML: SAML signing reads the signing credential directly and requires a private key. Use a custom ISamlSigningService for KMS-backed SAML signing.
  • The default SAML signing service is RSA-only. UseX509Certificate is not supported for EC keys — implement a custom ISamlSigningService for EC (or HSM/Key Vault) scenarios.

Service Provider Stores

In-Memory (Development)
csharp
.AddInMemorySamlServiceProviders(new[]
{
new SamlServiceProvider { EntityId = "...", /* ... */ }
});
EF Core (Production — Recommended)
csharp
.AddConfigurationStore(options =>
{
options.ConfigureDbContext = b =>
b.UseSqlServer(connectionString);
})

Run EF migrations: dotnet ef migrations add Update_DuendeIdentityServer_v8_0

Duende Storage (preview)

AddStorage(...) + AddConfigurationStorage() registers ISamlServiceProviderStore and AddOperationalStorage() registers ISamlSigninStateStore/ISamlLogoutSessionStore. ISamlServiceProviderAdmin creates/updates SPs (SamlServiceProviderConfiguration with EntityId, AssertionConsumerServiceUrls as SamlIndexedEndpointConfiguration). Data-extension properties on SPs are admin-only metadata: they are not projected onto the runtime SamlServiceProvider. See identityserver-duende-storage.

Custom Store
csharp
.AddSamlServiceProviderStore<MySamlSpStore>()
public class MySamlSpStore : ISamlServiceProviderStore
{
public Task<SamlServiceProvider?> FindByEntityIdAsync(
string entityId, CancellationToken ct)
{ /* lookup from your backend */ }
public IAsyncEnumerable<SamlServiceProvider> GetAllSamlServiceProvidersAsync(
CancellationToken ct)
{ /* stream all SPs */ }
}

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

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.

Extension points

  • pluginCustom plugin integration

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/duendesoftware/duende-skills/identityserver-saml/badge)](https://verified-skill.com/skills/duendesoftware/duende-skills/identityserver-saml)

Something wrong with this skill or its page? Tell us.