Ejemplo n.º 1
0
        public void AuthorizationLogic_CanViewPrivateKey_CertificateWithAllowUserPrincipalAce_ReturnsTrue()
        {
            AuthorizationLogic authorizationLogic = new AuthorizationLogic(null, GetAuditLogicMock());

            Certificate     certificate     = GetCertificateWithAllowUserPrincipalClaimNoExpiry();
            ClaimsPrincipal claimsPrincipal = GetClaimsPrincipalWithRole();

            bool isAuthorized = authorizationLogic.CanViewPrivateKey(certificate, claimsPrincipal);

            Assert.IsTrue(isAuthorized);
        }
Ejemplo n.º 2
0
        public void AuthorizationLogic_CanViewPrivateKey_CertificateWithDenyRole_DateExpiredAce_ReturnsFalse()
        {
            AuthorizationLogic authorizationLogic = new AuthorizationLogic(null, GetAuditLogicMock());

            Certificate     certificate     = GetCertificateWithDenyRoleClaimExpiredAce();
            ClaimsPrincipal claimsPrincipal = GetClaimsPrincipalWithRole();

            bool isAuthorized = authorizationLogic.CanViewPrivateKey(certificate, claimsPrincipal);

            Assert.IsFalse(isAuthorized);
        }
Ejemplo n.º 3
0
        public void AuthorizationLogic_CanViewPrivateKey_CertificateWithNoAcl_ReturnsFalse()
        {
            AuthorizationLogic authorizationLogic = new AuthorizationLogic(null, GetAuditLogicMock());

            Certificate     certificate     = new Certificate();
            ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal();

            bool isAuthorized = authorizationLogic.CanViewPrivateKey(certificate, claimsPrincipal);

            Assert.IsFalse(isAuthorized);
        }