Skip to content

Commit d9da9e3

Browse files
authored
Merge pull request #1208 from progressonderwijs/patrick/optionally_check_signature
Add an option to ignore signature validation
2 parents f675f79 + 8c82e16 commit d9da9e3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/ProgressOnderwijsUtils/SingleSignOn/SsoProcessor.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ static string EncodeQueryParameter(string key, string value)
4545
}
4646

4747
public static Maybe<SsoAttributes, string> GetAttributes(string rawSamlResponse, X509Certificate2 certificate)
48+
=> GetAttributes(rawSamlResponse, certificate, false);
49+
50+
[Obsolete("This method ignores signature validation and should not be used in production code")]
51+
public static Maybe<SsoAttributes, string> GetAttributesWithEvilIgnoreSignatureCheck(string rawSamlResponse, X509Certificate2 certificate)
52+
=> GetAttributes(rawSamlResponse, certificate, true);
53+
54+
static Maybe<SsoAttributes, string> GetAttributes(string rawSamlResponse, X509Certificate2 certificate, bool evilIgnoreSignatureCheck)
4855
{
4956
byte[] bytes;
5057
try {
@@ -85,7 +92,7 @@ public static Maybe<SsoAttributes, string> GetAttributes(string rawSamlResponse,
8592
return Maybe.Error("Public key missing");
8693
}
8794

88-
if (!dsig.CheckSignature(key)) {
95+
if (!dsig.CheckSignature(key) && !evilIgnoreSignatureCheck) {
8996
return Maybe.Error("Signature invalid");
9097
}
9198

0 commit comments

Comments
 (0)