//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
using System;
using System.IdentityModel.Configuration;
using System.IdentityModel.Tokens;
using System.Security.Claims;
using System.Xml;
namespace System.IdentityModel.Tokens
{
///
/// Interface that defines the name service that returns that issuer name
/// of a given token as string.
///
public abstract class IssuerNameRegistry : ICustomIdentityConfiguration
{
///
/// When implemented in the derived class, the method returns the issuer name of the given
/// SecurityToken's issuer. Implementations must return a non-null and non-empty string to
/// identify a recognized issuer, or a null string to identify an unrecognized issuer.
///
/// The SecurityToken whose name is requested.
/// Issuer name as a string.
public abstract string GetIssuerName( SecurityToken securityToken );
///
/// When implemented in the derived class the method returns the issuer name
/// of the given SecurityToken's issuer. The requested issuer name may be considered
/// in determining the issuer's name.
///
/// The SecurityToken whose name is requested.
/// Input to determine the issuer name
/// The default implementation ignores the requestedIsserName parameter and simply calls the
/// GetIssuerName( SecurityToken securityToken ) method
/// Issuer name as a string.
public virtual string GetIssuerName( SecurityToken securityToken, string requestedIssuerName )
{
return GetIssuerName( securityToken );
}
///
/// This function returns the default issuer name to be used for Windows claims.
///
/// Issuer name as a string.
public virtual string GetWindowsIssuerName()
{
return ClaimsIdentity.DefaultIssuer;
}
///
/// Load custom configuration from Xml
///
/// Custom configuration elements
public virtual void LoadCustomConfiguration(XmlNodeList nodelist)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException(SR.GetString(SR.ID0023, this.GetType().AssemblyQualifiedName)));
}
}
}