Redigeeri

Jagamisviis:


IssuerNameRegistry.GetIssuerName Method

Definition

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

Overloads

GetIssuerName(SecurityToken)

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

GetIssuerName(SecurityToken, String)

When overridden in a derived class, returns the name of the issuer of the specified security token. The specified issuer name may be considered in determining the issuer name to return.

Remarks

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.

GetIssuerName(SecurityToken)

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

public:
 abstract System::String ^ GetIssuerName(System::IdentityModel::Tokens::SecurityToken ^ securityToken);
public abstract string GetIssuerName (System.IdentityModel.Tokens.SecurityToken securityToken);
abstract member GetIssuerName : System.IdentityModel.Tokens.SecurityToken -> string
Public MustOverride Function GetIssuerName (securityToken As SecurityToken) As String

Parameters

securityToken
SecurityToken

The security token for which to return the issuer name.

Returns

The issuer name.

Examples

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

Warning

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.");
}

Remarks

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.

See also

Applies to

GetIssuerName(SecurityToken, String)

When overridden in a derived class, returns the name of the issuer of the specified security token. The specified issuer name may be considered in determining the issuer name to return.

public:
 virtual System::String ^ GetIssuerName(System::IdentityModel::Tokens::SecurityToken ^ securityToken, System::String ^ requestedIssuerName);
public virtual string GetIssuerName (System.IdentityModel.Tokens.SecurityToken securityToken, string requestedIssuerName);
abstract member GetIssuerName : System.IdentityModel.Tokens.SecurityToken * string -> string
override this.GetIssuerName : System.IdentityModel.Tokens.SecurityToken * string -> string
Public Overridable Function GetIssuerName (securityToken As SecurityToken, requestedIssuerName As String) As String

Parameters

securityToken
SecurityToken

The security token for which to return the issuer name.

requestedIssuerName
String

An issuer name to consider in the request.

Returns

The issuer name.

Remarks

The default implementation ignores the requestedIssuerName parameter and simply calls the IssuerNameRegistry.GetIssuerName(SecurityToken) method.

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.

See also

Applies to