Share via


SamlSecurityTokenHandler.CreateSubject(SecurityTokenDescriptor) Method

Definition

Returns the SamlSubject to use for all the statements that will be created. Overwrite this method to customize the creation of the SamlSubject.

protected virtual Microsoft.IdentityModel.Tokens.Saml.SamlSubject CreateSubject (Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor tokenDescriptor);
abstract member CreateSubject : Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor -> Microsoft.IdentityModel.Tokens.Saml.SamlSubject
override this.CreateSubject : Microsoft.IdentityModel.Tokens.SecurityTokenDescriptor -> Microsoft.IdentityModel.Tokens.Saml.SamlSubject
Protected Overridable Function CreateSubject (tokenDescriptor As SecurityTokenDescriptor) As SamlSubject

Parameters

tokenDescriptor
SecurityTokenDescriptor

Contains all the information that is used in token issuance.

Returns

A SamlSubject created from the first subject found in the tokenDescriptor as follows:

1. Claim of Type NameIdentifier is searched. If found, SamlSubject.Name is set to claim.Value. 2. If a non-null tokenDescriptor.proof is found then SamlSubject.KeyIdentifier = tokenDescriptor.Proof.KeyIdentifier AND SamlSubject.ConfirmationMethod is set to 'HolderOfKey'. 3. If a null tokenDescriptor.proof is found then SamlSubject.ConfirmationMethod is set to 'BearerKey'.

Exceptions

if tokenDescriptor is null.

if the tokenDescriptor has more than one name identifier claim.

Applies to