Export (0) Print
Expand All

IssuerNameRegistry.GetIssuerName Method (SecurityToken)

.NET Framework 4.5

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.

Caution noteCaution

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

Supported in: 4.6, 4.5

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

© 2014 Microsoft