Esempio n. 1
0
        public override string GetIssuerName(SecurityToken securityToken)
        {
            var x509SecurityToken = securityToken as X509SecurityToken;

            if (x509SecurityToken == null)
            {
                throw new ApplicationException("The issue name can not be resolved");
            }
            var cert = x509SecurityToken.Certificate.Thumbprint;

            if (ConfiguredTrustedIssuers.Any(c => c.Key == cert))
            {
                return(((X509SecurityToken)securityToken).Certificate.Subject);
            }
            throw new ApplicationException("Token not authorized.");
        }
        public override string GetIssuerName(SecurityToken securityToken)
        {
            if (securityToken == null)
            {
                throw new Exception("securityToken");
            }
            var token = securityToken as X509SecurityToken;

            if (token != null)
            {
                var thumbprint = token.Certificate.Thumbprint;
                if (ConfiguredTrustedIssuers.ContainsKey(thumbprint)) //Breakpoint here
                {
                    return(ConfiguredTrustedIssuers[thumbprint]);
                }
            }
            return(null);
            //var ret = base.GetIssuerName(securityToken);
            //return ret;
        }