Beispiel #1
0
        public TestAcl()
        {
            _Url = "http://+:9393/";
            HttpAPIManager manager = new HttpAPIManager();

            manager.SetUrlAcl(_Url, SecurityDescriptor.FromSDDL("D:(A;;GX;;;WD)"));
        }
Beispiel #2
0
        public void CanSetUrlTwiceAndSetToNullToRemove()
        {
            var            testUrl = "http://+:9394/";
            HttpAPIManager manager = new HttpAPIManager();

            manager.SetUrlAcl(testUrl, SecurityDescriptor.FromSDDL("D:(A;;GX;;;WD)"));
            manager.SetUrlAcl(testUrl, SecurityDescriptor.FromSDDL("D:(A;;;;;WD)"));
            Assert.Equal("D:(A;;;;;WD)", manager.GetAclInfo(testUrl).SecurityDescriptor.ToString());
            manager.SetUrlAcl(testUrl, null);
            Assert.Null(manager.GetAclInfo(testUrl));
        }
Beispiel #3
0
        public void CanQueryAcls()
        {
            HttpAPIManager manager = new HttpAPIManager();
            var            testUrl = "http://+:9399/CanQueryAclsTest";

            manager.SetUrlAcl(testUrl, SecurityDescriptor.FromSDDL("D:(A;;;;;WD)"));
            try
            {
                var containsTemporaryUrl = manager.GetAclInfo().Any(url => url.Prefix.Contains("CanQueryAclsTest"));
                Assert.True(containsTemporaryUrl, "You should be able to retrieve Acls");
            }
            finally
            {
                manager.RemoveUrlAcl(testUrl);
            }
        }
Beispiel #4
0
        public void CanAddAndRemoveAcl()
        {
            var            testUrl = "http://+:9393/";
            HttpAPIManager manager = new HttpAPIManager();

            manager.SetUrlAcl(testUrl, SecurityDescriptor.FromSDDL("D:(A;;GX;;;WD)"));
            try
            {
                var acl = manager.GetAclInfo(testUrl);
                Assert.NotNull(acl);
                var fakeAcl = manager.GetAclInfo("unknown");
                Assert.Null(fakeAcl);
            }
            finally
            {
                manager.RemoveUrlAcl(testUrl);
            }
            var oldAcl = manager.GetAclInfo(testUrl);

            Assert.Null(oldAcl);
        }