public TestAcl() { _Url = "http://+:9393/"; HttpAPIManager manager = new HttpAPIManager(); manager.SetUrlAcl(_Url, SecurityDescriptor.FromSDDL("D:(A;;GX;;;WD)")); }
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)); }
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); } }
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); }