public async Task VerifyAuthRequestSignature() { //ARRANGE var signatureManager = new XmlSignatureManager(); var document = new XmlDocument(); var request = await SamlPostRequestProviderMock.BuildAuthnRequest(); document.LoadXml(request.Item1); var cert = CertificateProviderMock.GetMockCertificate(); //ACT var isValid = signatureManager.VerifySignature(document, cert.PublicKey.Key); //ASSERT Assert.True(isValid); }
public void SignResponse_namespace_not_included() { //ARRANGE var signatureManager = new XmlSignatureManager(); var inResponseTo = "Test_" + Guid.NewGuid(); var tokenResponse = ResponseFactoryMock.GetTokenResponseSuccess(inResponseTo); var cert = CertificateProviderMock.GetMockCertificate(); var serialised = ResponseFactoryMock.Serialize(tokenResponse); var document = new XmlDocument(); document.LoadXml(serialised); //ACT signatureManager.WriteSignature(document, tokenResponse.ID, cert.PrivateKey, String.Empty, String.Empty); var isValid = signatureManager.VerifySignature(document, cert.PublicKey.Key); //ASSERT Assert.True(isValid); }