forked from Sustainsys/Saml2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better exception messages on SAML Response validation failures.
- Fixes Sustainsys#66. - Saml2Respone.Validate is now a private method which is automatically called when needed by the Saml2Response class. - Errors are reported through exceptions, with better exception messages.
- Loading branch information
Showing
12 changed files
with
387 additions
and
226 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
338 changes: 182 additions & 156 deletions
338
Kentor.AuthServices.Tests/Saml2P/Saml2ResponseTests.cs
Large diffs are not rendered by default.
Oops, something went wrong.
43 changes: 43 additions & 0 deletions
43
Kentor.AuthServices.Tests/Saml2ResponseFailedValidationExceptionTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
using FluentAssertions; | ||
|
||
namespace Kentor.AuthServices.Tests | ||
{ | ||
[TestClass] | ||
public class Saml2ResponseFailedValidationExceptionTests | ||
{ | ||
[TestMethod] | ||
public void Saml2ResponseFailedValidationExecption_DefaultCtor() | ||
{ | ||
ExceptionTestHelpers.TestDefaultCtor<Saml2ResponseFailedValidationException>(); | ||
} | ||
|
||
[TestMethod] | ||
public void Saml2ResponseFailedValidationExecption_SerializationCtor() | ||
{ | ||
ExceptionTestHelpers.TestSerializationCtor<Saml2ResponseFailedValidationException>(); | ||
} | ||
|
||
[TestMethod] | ||
public void Saml2ResponseFailedValidationExecption_StringCtor() | ||
{ | ||
var msg = "Message!"; | ||
var subject = new Saml2ResponseFailedValidationException(msg); | ||
|
||
subject.Message.Should().Be(msg); | ||
} | ||
|
||
[TestMethod] | ||
public void Saml2ResponseFailedValidationException_InnerExceptionCtor() | ||
{ | ||
var msg = "Message!"; | ||
var innerException = new InvalidOperationException("InnerMessage!"); | ||
|
||
var subject = new Saml2ResponseFailedValidationException(msg, innerException); | ||
|
||
subject.Message.Should().Be("Message!"); | ||
subject.InnerException.Message.Should().Be("InnerMessage!"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.