예제 #1
0
        public bool ValidateUser(System.Security.Cryptography.X509Certificates.X509Certificate2 clientCertificate, out string userName)
        {
            UserAccount user;

            if (userSvc.AuthenticateWithCertificate(clientCertificate, out user))
            {
                userName = user.Username;
                return(true);
            }

            userName = null;
            return(false);
        }
예제 #2
0
        public void AuthenticateWithCertificate_ValidCert_ReturnsTrue()
        {
            var cert = GetTestCert();

            securitySettings.RequireAccountVerification = false;
            var acct = subject.CreateAccount("test", "pass", "*****@*****.**");

            acct.AddCertificate(cert);
            subject.Update(acct);

            Assert.IsTrue(subject.AuthenticateWithCertificate(cert));
        }