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.
Throw on saml response from wrong idp.
- Added new exception class Saml2ResponseFailedValidationException.
- Loading branch information
1 parent
f1933bb
commit ffa14b4
Showing
6 changed files
with
91 additions
and
4 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
31 changes: 31 additions & 0 deletions
31
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,31 @@ | ||
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); | ||
} | ||
} | ||
} |
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
47 changes: 47 additions & 0 deletions
47
Kentor.AuthServices/Saml2ResponseFailedValidationException.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,47 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Runtime.Serialization; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace Kentor.AuthServices | ||
{ | ||
/// <summary> | ||
/// A SAML2 Response failed validation. | ||
/// </summary> | ||
[Serializable] | ||
public class Saml2ResponseFailedValidationException : AuthServicesException | ||
{ | ||
/// <summary> | ||
/// Ctor | ||
/// </summary> | ||
public Saml2ResponseFailedValidationException() | ||
{ } | ||
|
||
/// <summary> | ||
/// Ctor | ||
/// </summary> | ||
/// <param name="message">Message of the exception.</param> | ||
public Saml2ResponseFailedValidationException(string message) : base(message) | ||
{ } | ||
|
||
/// <summary> | ||
/// Ctor | ||
/// </summary> | ||
/// <param name="message">Message of the exception.</param> | ||
/// <param name="innerException">Inner exception.</param> | ||
public Saml2ResponseFailedValidationException(string message, Exception innerException) | ||
: base(message, innerException) | ||
{ } | ||
|
||
/// <summary> | ||
/// Serialization Ctor | ||
/// </summary> | ||
/// <param name="info">Serialization info</param> | ||
/// <param name="context">Serialization context</param> | ||
protected Saml2ResponseFailedValidationException(SerializationInfo info, StreamingContext context) | ||
: base(info, context) | ||
{ } | ||
} | ||
} |