IssuerNameRegistry.GetIssuerName Method (SecurityToken)

.NET Framework (current version)

The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

When overridden in a derived class, returns the name of the issuer of the specified security token.

Namespace:   System.IdentityModel.Tokens
Assembly:  System.IdentityModel (in System.IdentityModel.dll)

public abstract string GetIssuerName(
	SecurityToken securityToken


Type: System.IdentityModel.Tokens.SecurityToken

The security token for which to return the issuer name.

Return Value

Type: System.String

The issuer name.

Implementations should return a non-null and non-empty string to identify a recognized issuer, or a null string to identify an unrecognized issuer.

Called from the processing pipeline by the security token handler that is processing the token. The method should return a unique name for the issuer within the context of the RP application.

The following code shows the GetIssuerName method for an issuer name registry. The full sample is in the IssuerNameRegistry class overview topic.


The following code is for illustrative purposes only. Validating certificates based on subject name is not a good practice. This code should not be used as is in production.

/// <summary>
/// Gets the issuer name of the given security token,
/// if it is the X509SecurityToken of 'localhost'.
/// </summary>
/// <param name="securityToken">The issuer's security token</param>
/// <returns>A string that represents the issuer name</returns>
/// <exception cref="SecurityTokenException">If the issuer is not trusted.</exception>
public override string GetIssuerName(SecurityToken securityToken)
    X509SecurityToken x509Token = securityToken as X509SecurityToken;
    if (x509Token != null)
        if (String.Equals(x509Token.Certificate.SubjectName.Name, "CN=localhost"))
            return x509Token.Certificate.SubjectName.Name;

    throw new SecurityTokenException("Untrusted issuer.");

.NET Framework
Available since 4.5
Return to top