Skip to content

Commit

Permalink
Moved Saml2Response_Validate_ThrowsOnMissingReferenceInSignature to n…
Browse files Browse the repository at this point in the history
…on-premium test project.

- It was in the premium test proj because generating the invalid signature required Shims, but
  instead of generating it each time I just saved the resulting message.
  • Loading branch information
AndersAbel committed Feb 20, 2015
1 parent ed2d1ab commit 7999794
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 166 deletions.
13 changes: 13 additions & 0 deletions Kentor.AuthServices.Tests/Saml2P/Saml2ResponseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,19 @@ public void Saml2Response_GetClaims_ThrowsOnIncorrectTransformsInSignature()
.WithMessage("Transform \"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" found in XML signature is not allowed in SAML.");
}

[TestMethod]
public void Saml2Response_Validate_ThrowsOnMissingReferenceInSignature()
{
var signedWithoutReference = @"<saml2p:Response xmlns:saml2p=""urn:oasis:names:tc:SAML:2.0:protocol"" xmlns:saml2=""urn:oasis:names:tc:SAML:2.0:assertion"" ID=""Saml2Response_Validate_FalseOnMissingReference"" Version=""2.0"" IssueInstant=""2013-01-01T00:00:00Z""><saml2:Issuer>https://idp.example.com</saml2:Issuer><saml2p:Status><saml2p:StatusCode Value=""urn:oasis:names:tc:SAML:2.0:status:Requester"" /></saml2p:Status><Signature xmlns=""http://www.w3.org/2000/09/xmldsig#""><SignedInfo><CanonicalizationMethod Algorithm=""http://www.w3.org/TR/2001/REC-xml-c14n-20010315"" /><SignatureMethod Algorithm=""http://www.w3.org/2000/09/xmldsig#rsa-sha1"" /></SignedInfo><SignatureValue>tYFIoYmrzmp3H7TXm9IS8DW3buBZIb6sI2ycrn+AOnVcdYnPTJpk3ntHlqQKXNEyXgXZNdqEuFpgI1I0P0TlhM+C3rBJnflkApkxZkak5RwnJzDWTHpsSDjYcm+/XgBy3JVZJuMWb2YPaV8GB6cjBMDrENUEaoKRg+FpzPUZO1EOMcqbocXp5cHie1CkPnD1OtT/cuzMBUMpBGZMxjZwdFpOO7R3CUXh/McxKfoGUQGC3DVpt5T8uGkpj4KqZVPS/qTCRhbPRDjg73BdWbdkFpFWge8G/FgkYxr9LBE1TsrxptppO9xoA5jXwJVZaWndSMvo6TuOjUgqY2w5RTkqhA==</SignatureValue></Signature></saml2p:Response>";

var samlResponse = Saml2Response.Read(signedWithoutReference);

Action a = () => samlResponse.GetClaims(Options.FromConfiguration);

a.ShouldThrow<Saml2ResponseFailedValidationException>()
.WithMessage("No reference found in Xml signature, it doesn't validate the Xml data.");
}

[TestMethod]
public void Saml2Response_GetClaims_ReturnsExistingResultOnSecondGetClaimsCall()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@
<Link>MetadataServer.cs</Link>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Saml2ResponseTests.cs" />
<Compile Include="AuthServicesControllerTests.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
165 changes: 0 additions & 165 deletions Kentor.AuthServices.VSPremium.Tests/Saml2ResponseTests.cs

This file was deleted.

0 comments on commit 7999794

Please sign in to comment.