File: IssuerNameRegistry.cs

package info (click to toggle)
mono 4.6.2.7%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 778,148 kB
  • ctags: 914,052
  • sloc: cs: 5,779,509; xml: 2,773,713; ansic: 432,645; sh: 14,749; makefile: 12,361; perl: 2,488; python: 1,434; cpp: 849; asm: 531; sql: 95; sed: 16; php: 1
file content (61 lines) | stat: -rw-r--r-- 2,820 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
//------------------------------------------------------------------------------
//     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
{
    /// <summary>
    /// Interface that defines the name service that returns that issuer name
    /// of a given token as string. 
    /// </summary>
    public abstract class IssuerNameRegistry : ICustomIdentityConfiguration
    {
        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="securityToken">The SecurityToken whose name is requested.</param>
        /// <returns>Issuer name as a string.</returns>
        public abstract string GetIssuerName( SecurityToken securityToken );

        /// <summary>
        /// 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.
        /// </summary>
        /// <param name="securityToken">The SecurityToken whose name is requested.</param>
        /// <param name="requestedIssuerName">Input to determine the issuer name</param>
        /// <remarks>The default implementation ignores the requestedIsserName parameter and simply calls the 
        /// GetIssuerName( SecurityToken securityToken ) method</remarks>
        /// <returns>Issuer name as a string.</returns>
        public virtual string GetIssuerName( SecurityToken securityToken, string requestedIssuerName )
        {
            return GetIssuerName( securityToken );
        }

        /// <summary>
        /// This function returns the default issuer name to be used for Windows claims.
        /// </summary>
        /// <returns>Issuer name as a string.</returns>
        public virtual string GetWindowsIssuerName()
        {
            return ClaimsIdentity.DefaultIssuer;
        }

        /// <summary>
        /// Load custom configuration from Xml
        /// </summary>
        /// <param name="nodelist">Custom configuration elements</param>
        public virtual void LoadCustomConfiguration(XmlNodeList nodelist)
        {
            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotImplementedException(SR.GetString(SR.ID0023, this.GetType().AssemblyQualifiedName)));
        }
    }
}