VOOZH about

URL: https://www.nuget.org/packages/Aguacongas.IdentityServer.Saml2p.Duende/

⇱ NuGet Gallery | Aguacongas.IdentityServer.Saml2p.Duende 10.0.4




👁 Image
Aguacongas.IdentityServer.Saml2p.Duende 10.0.4

dotnet add package Aguacongas.IdentityServer.Saml2p.Duende --version 10.0.4
 
 
NuGet\Install-Package Aguacongas.IdentityServer.Saml2p.Duende -Version 10.0.4
 
 
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Aguacongas.IdentityServer.Saml2p.Duende" Version="10.0.4" />
 
 
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Aguacongas.IdentityServer.Saml2p.Duende" Version="10.0.4" />
 
Directory.Packages.props
<PackageReference Include="Aguacongas.IdentityServer.Saml2p.Duende" />
 
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Aguacongas.IdentityServer.Saml2p.Duende --version 10.0.4
 
 
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Aguacongas.IdentityServer.Saml2p.Duende, 10.0.4"
 
 
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Aguacongas.IdentityServer.Saml2p.Duende@10.0.4
 
 
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Aguacongas.IdentityServer.Saml2p.Duende&version=10.0.4
 
Install as a Cake Addin
#tool nuget:?package=Aguacongas.IdentityServer.Saml2p.Duende&version=10.0.4
 
Install as a Cake Tool
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

Aguacongas.IdentityServer.Saml2p.Duende

Add a SAML2P controller to your Duende Identity server.
This lib uses ITfoxtec.Identity.Saml2.MvcCore internally to implements the protocol.

Setup

services.AddIdentityServer()
 .AddKeysRotation(options => configuration.GetSection(nameof(KeyRotationOptions))?.Bind(options));

services.AddControllersWithViews()
 .AddIdentityServerSaml2P();

Saml2P depends on a ISigningCredentialStore. You can register it using AddSigningCredential with a X509Certificate2 in place of AddKeysRotation if you prefer.

Usage

saml2p/metadata returns the Saml2P metadata document.

You can add a client to you configuration with saml2p as protocol type:

new Client
{
 ClientId = "itfoxtec-testwebappcore",
 ProtocolType = ProtocolTypes.Saml2p,

 RedirectUris = { "http://localhost:10314/Auth/AssertionConsumerService" },
 PostLogoutRedirectUris = "http://localhost:10314/Auth/SingleLogout",

 ClientSecrets = [
 new Secret {
 Type = SecretTypes.X509CertificateBase64,
 Value = Convert.ToBase64String(certificate.Export(X509ContentType.Cert))
 }
 ]
}

The client must have only one redirect uri pointing to the Assertion Consumer Service route and one X509Certificate secret mathing its signing certificate.

And configure the client to use Saml2P authentication using ITfoxtec.Identity.Saml2:

services.BindConfig<Saml2Configuration>(Configuration, "Saml2", (serviceProvider, saml2Configuration) =>
{
 // The certificate must be the one configured as secret for the client;
 saml2Configuration.SigningCertificate = CertificateUtil.Load(AppEnvironment.MapToPhysicalFilePath(Configuration["Saml2:SigningCertificateFile"]), Configuration["Saml2:SigningCertificatePassword"], X509KeyStorageFlags.MachineKeySet | X509KeyStorageFlags.PersistKeySet);
 saml2Configuration.AllowedAudienceUris.Add(saml2Configuration.Issuer);

 var httpClientFactory = serviceProvider.GetService<IHttpClientFactory>();
 var entityDescriptor = new EntityDescriptor();
 entityDescriptor.ReadIdPSsoDescriptorFromUrlAsync(httpClientFactory, new Uri(Configuration["Saml2:IdPMetadata"])).GetAwaiter().GetResult();
 if (entityDescriptor.IdPSsoDescriptor != null)
 {
 saml2Configuration.AllowedIssuer = entityDescriptor.EntityId;
 saml2Configuration.SingleSignOnDestination = entityDescriptor.IdPSsoDescriptor.SingleSignOnServices.First().Location;
 saml2Configuration.SingleLogoutDestination = entityDescriptor.IdPSsoDescriptor.SingleLogoutServices.First().Location;
 foreach (var signingCertificate in entityDescriptor.IdPSsoDescriptor.SigningCertificates)
 {
 if (signingCertificate.IsValidLocalTime())
 {
 saml2Configuration.SignatureValidationCertificates.Add(signingCertificate);
 }
 }
 if (saml2Configuration.SignatureValidationCertificates.Count <= 0)
 {
 throw new Exception("The IdP signing certificates has expired.");
 }
 if (entityDescriptor.IdPSsoDescriptor.WantAuthnRequestsSigned.HasValue)
 {
 saml2Configuration.SignAuthnRequest = entityDescriptor.IdPSsoDescriptor.WantAuthnRequestsSigned.Value;
 }
 }
 else
 {
 throw new Exception("IdPSsoDescriptor not loaded from metadata.");
 }

 return saml2Configuration;
}); 

services.AddSaml2(slidingExpiration: true);
services.AddHttpClient();

appsettings.json

{
 "Saml2": {
 "IdPMetadata": "https://localhost:5443/saml2p/metadata", // Your Duende Identity server metadata uri
 "Issuer": "itfoxtec-testwebappcore", // Client Id
 "SignatureAlgorithm": "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
 "SigningCertificateFile": "itfoxtec.identity.saml2.testwebappcore_Certificate.pfx",
 "SigningCertificatePassword": "!QAZ2wsx",
 "CertificateValidationMode": "None", // "ChainTrust"
 "RevocationMode": "NoCheck"
 }
}

Review samples in ITfoxtec/ITfoxtec.Identity.Saml2 repo

Metadata configuration

AddIdentityServerSaml2P extension accept a IConfiguration or a Saml2POptions parameter to configure the metadata document génération with claims lists.

mvcBuilder.AddIdentityServerSaml2P(configurationManager.GetSection(nameof(Saml2POptions)));
"Saml2POptions": {
 "X509CertificateValidationMode": "None",
 "ContactPersons": [
 {
 "ContactKind": "Technical",
 "Company": "Aguafrommars",
 "GivenName": "Olivier Lefebvre",
 "SurName": "Aguacongas",
 "EmailAddress": "aguacongas@gmail.com"
 }
 ],
 "RevocationMode": "NoCheck",
 "SignatureAlgorithm": "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
 "ValidUntil": 365
 }

Implement your store

To access data the use a . You can implement this interface and provide your implementation to the DI to ovveride the default implementation.

/// <summary>
/// Custom IRelyingPartyStore implementation
/// </summary>
/// <seealso cref="IRelyingPartyStore" />
public class MyRelyingPartyStore : IRelyingPartyStore
{
 public async Task<RelyingParty> FindRelyingPartyByRealm(string realm)
 {
 // TODO: Implement me
 throw new NotImplementedException();
 }
}

The DI configuration become:

services.AddIdentityServer()
 .AddKeysRotation(options => configuration.GetSection(nameof(KeyRotationOptions))?.Bind(options));

services.AddControllersWithViews()
 .AddIdentityServerSaml2P();

services.AddTransient<IRelyingPartyStore, MyRelyingPartyStore>();
Product Versions Compatible and additional computed target framework versions.
.NET net10.0 net10.0 is compatible.  net10.0-android net10.0-android was computed.  net10.0-browser net10.0-browser was computed.  net10.0-ios net10.0-ios was computed.  net10.0-maccatalyst net10.0-maccatalyst was computed.  net10.0-macos net10.0-macos was computed.  net10.0-tvos net10.0-tvos was computed.  net10.0-windows net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
10.0.4 110 5/14/2026
10.0.3 118 4/23/2026
10.0.2 146 2/13/2026
10.0.1 215 11/28/2025
10.0.0 399 11/17/2025
9.1.2 214 9/7/2025
9.1.1 320 3/18/2025
9.1.1-preview21- 256 3/18/2025
9.1.0 244 2/22/2025
9.0.0 252 2/22/2025
9.0.0-preview106- 153 2/22/2025
8.3.0 264 12/28/2024
8.2.1 262 12/28/2024
8.2.0 238 11/9/2024
8.1.1 248 11/9/2024
8.1.0-preview57- 184 11/3/2024
8.0.1 649 9/22/2024
8.0.0 331 3/9/2024
8.0.0-preview1-0001 310 11/18/2023
Loading failed