public void SignAsyncAuthZViaSubjectRegEx() { DsspClient dsspClient = new DsspClient("https://www.e-contract.be/dss-ws/dss"); dsspClient.Application.X509.Certificate = new X509Certificate2("certificate.p12", ""); DsspSession s; using (Stream i = File.OpenRead("Blank.pdf")) { Document id = new Document("application/pdf", i); s = dsspClient.UploadDocument(id); } String correct = ".*Bryan Brouckaert.*"; Authorization authz = Authorization.AllowDssSignIfMatchSubjectRegex(correct); String signResponse = emulateBrowser( s.GeneratePendingRequest(new Uri("http://localhost/dssp"), "EN", authz), "View Document"); try { using (Stream i = File.OpenRead("Blank.pdf")) { Document id = new Document("application/pdf", i); s = dsspClient.UploadDocument(id); } authz = Authorization.DenyDssSignIfMatchSubjectRegex(correct); signResponse = emulateBrowser( s.GeneratePendingRequest(new Uri("http://localhost/dssp"), "EN", authz), "View Document"); Assert.Fail("should fail with wrong"); } catch (InvalidOperationException) { } try { using (Stream i = File.OpenRead("Blank.pdf")) { Document id = new Document("application/pdf", i); s = dsspClient.UploadDocument(id); } authz = Authorization.AllowDssSignIfMatchSubject(".*Brian Broeckaert.*"); signResponse = emulateBrowser( s.GeneratePendingRequest(new Uri("http://localhost/dssp"), "EN", authz), "View Document"); Assert.Fail("should fail with wrong"); } catch (InvalidOperationException) { } }