Table of Contents

Class DefaultSamlNameIdGenerator

Namespace
Fdyay.IdentityServer.Saml.Idp
Assembly
Fdyay.IdentityServer.Saml.dll

Issues an emailAddress NameID from the user's email claim and every other format from sub. Duende's DefaultSamlNameIdGenerator, measured.

public sealed class DefaultSamlNameIdGenerator : ISamlNameIdGenerator
Inheritance
DefaultSamlNameIdGenerator
Implements
Inherited Members

Constructors

DefaultSamlNameIdGenerator(IOptions<SamlOptions>)

Creates the generator.

public DefaultSamlNameIdGenerator(IOptions<SamlOptions> options)

Parameters

options IOptions<SamlOptions>

The SAML options, whose EmailNameIdClaimType applies when the provider names no claim of its own.

Methods

GenerateAsync(NameIdGenerationContext, CancellationToken)

The NameID to issue for context's user, or the status to refuse the sign-on with.

public Task<NameIdGenerationResult> GenerateAsync(NameIdGenerationContext context, CancellationToken cancellationToken = default)

Parameters

context NameIdGenerationContext

The user, the service provider and the format already resolved.

cancellationToken CancellationToken

Cancels the generation.

Returns

Task<NameIdGenerationResult>

A result carrying the NameID, or a refusal status with no NameID.

Remarks

For EmailAddress, the value of the provider's EmailNameIdClaimType claim, else the options' one. For any other format, the sub claim, else NameIdentifier, issued in the resolved format. A missing or blank claim is a Responder/InvalidNameIDPolicy refusal rather than an exception.

Exceptions

ArgumentNullException

context is null.