Skip to content

Commit 80bb70d

Browse files
committed
SAML down party checks AuthenticationMethod and AuthenticationInstant.
Claim transform do not remove all on remove.
1 parent 0cea23e commit 80bb70d

File tree

8 files changed

+15
-7
lines changed

8 files changed

+15
-7
lines changed

src/FoxIDs.Control/FoxIDs.Control.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>1.15.6</Version>
5+
<Version>1.15.7</Version>
66
<RootNamespace>FoxIDs</RootNamespace>
77
<Authors>Anders Revsgaard</Authors>
88
<Company>ITfoxtec</Company>

src/FoxIDs.ControlClient/FoxIDs.ControlClient.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>1.15.6</Version>
5+
<Version>1.15.7</Version>
66
<RootNamespace>FoxIDs.Client</RootNamespace>
77
<Authors>Anders Revsgaard</Authors>
88
<Company>ITfoxtec</Company>

src/FoxIDs.ControlShared/FoxIDs.ControlShared.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>1.15.6</Version>
5+
<Version>1.15.7</Version>
66
<RootNamespace>FoxIDs</RootNamespace>
77
<Authors>Anders Revsgaard</Authors>
88
<Company>ITfoxtec</Company>

src/FoxIDs.Shared/FoxIDs.Shared.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>1.15.6</Version>
5+
<Version>1.15.7</Version>
66
<RootNamespace>FoxIDs</RootNamespace>
77
<Authors>Anders Revsgaard</Authors>
88
<Company>ITfoxtec</Company>

src/FoxIDs.SharedBase/FoxIDs.SharedBase.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<TargetFramework>net9.0</TargetFramework>
5-
<Version>1.15.6</Version>
5+
<Version>1.15.7</Version>
66
<RootNamespace>FoxIDs</RootNamespace>
77
<Authors>Anders Revsgaard</Authors>
88
<Company>ITfoxtec</Company>

src/FoxIDs/FoxIDs.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Web">
22
<PropertyGroup>
33
<TargetFramework>net9.0</TargetFramework>
4-
<Version>1.15.6</Version>
4+
<Version>1.15.7</Version>
55
<RootNamespace>FoxIDs</RootNamespace>
66
<Authors>Anders Revsgaard</Authors>
77
<Company>ITfoxtec</Company>

src/FoxIDs/Logic/Saml/SamlAuthnDownLogic.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,15 @@ private async Task<IActionResult> AuthnResponseAsync(SamlDownParty party, SamlDo
275275
var tokenDescriptor = saml2AuthnResponse.CreateTokenDescriptor(samlClaimsDownLogic.GetSubjectClaims(party, claims), party.Issuer, tokenIssueTime, party.IssuedTokenLifetime);
276276

277277
var authnContext = claims.FindFirstOrDefaultValue(c => c.Type == ClaimTypes.AuthenticationMethod);
278+
if (string.IsNullOrEmpty(authnContext))
279+
{
280+
throw new InvalidOperationException($"The authentication method '{ClaimTypes.AuthenticationMethod}' claim is empty.");
281+
}
278282
var authenticationInstant = claims.FindFirstOrDefaultValue(c => c.Type == ClaimTypes.AuthenticationInstant);
283+
if (string.IsNullOrEmpty(authenticationInstant))
284+
{
285+
throw new InvalidOperationException($"The authentication instant '{ClaimTypes.AuthenticationInstant}' claim is empty.");
286+
}
279287
var authenticationStatement = saml2AuthnResponse.CreateAuthenticationStatement(authnContext, DateTime.Parse(authenticationInstant));
280288

281289
var subjectConfirmation = saml2AuthnResponse.CreateSubjectConfirmation(tokenIssueTime, party.SubjectConfirmationLifetime);

src/FoxIDs/Logic/Tracks/ClaimTransformLogic.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,7 @@ private static void AddOrReplaceClaims(List<Claim> outputClaims, ClaimTransformA
714714
break;
715715
case ClaimTransformActions.Replace:
716716
case ClaimTransformActions.ReplaceIfNot:
717-
outputClaims.RemoveAll(c => newClaims.Any(c => c.Type.Equals(c.Type, StringComparison.Ordinal)));
717+
outputClaims.RemoveAll(c => newClaims.Any(nc => nc.Type.Equals(c.Type, StringComparison.Ordinal)));
718718
outputClaims.AddRange(newClaims);
719719
break;
720720
default:

0 commit comments

Comments
 (0)