Пример #1
0
        public override string GetIssuerName(SecurityToken securityToken)
        {
            if (securityToken == null)
            {
                throw new ArgumentNullException("securityToken");
            }
            X509SecurityToken token = securityToken as X509SecurityToken;

            if (token != null)
            {
                string thumbprint = token.Certificate.Thumbprint;

                if (this._configuredTrustedIssuers.ContainsKey(thumbprint))
                {
                    string str2 = this._configuredTrustedIssuers[thumbprint];
                    str2 = string.IsNullOrEmpty(str2) ? token.Certificate.Subject : str2;
                    return(str2);
                }


                throw new KeyNotFoundException(string.Format("Could not find Thumbprint '{0}' in trusted issuers list : {1}  :: Char Codes {2} vs {3}", thumbprint, string.Join(",", _configuredTrustedIssuers.Keys.ToArray <string>()), SamlHelpers.ToCompositeString(thumbprint), SamlHelpers.ToCompositeString(string.Join(",", _configuredTrustedIssuers.Keys.ToArray <string>()))));
            }

            //Throw our own exception to make it easier to debug
            throw new ArgumentException("Unable to validate token issuer the provided token was not a X509SecurityToken; cant determine the thumbprint to match", "securityToken");
        }