Skip to content

Commit

Permalink
Merge pull request #205 from ITfoxtec/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
Revsgaard authored Jun 2, 2024
2 parents 9e75ecc + 5d5e85e commit a8da2c1
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Support the Danish NemLog-in 2 / OIOSAML 2 and NemLog-in 3 / OIOSAML 3.</Descrip
<PackageTags>SAML SAML 2.0 SAML2.0 SAML2 SAML 2 SAML-P SAMLP SSO Identity Provider (IdP) and Relying Party (RP) Authentication Metadata OIOSAML OIOSAML 2 OIOSAML 3 NemLogin NemLog-in 2 NemLog-in 3 ASP.NET MVC</PackageTags>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageIconUrl>https://itfoxtec.com/favicon.ico</PackageIconUrl>
<AssemblyVersion>4.10.9.3</AssemblyVersion>
<FileVersion>4.10.9.3</FileVersion>
<Copyright>Copyright © 2023</Copyright>
<Version>4.10.9-beta3</Version>
<AssemblyVersion>4.11.0</AssemblyVersion>
<FileVersion>4.11.0</FileVersion>
<Copyright>Copyright © 2024</Copyright>
<Version>4.11.0</Version>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ITfoxtec.SAML2.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ Support the Danish NemLog-in 2 / OIOSAML 2 and NemLog-in 3 / OIOSAML 3.</Descrip
<PackageTags>SAML SAML 2.0 SAML2.0 SAML2 SAML 2 SAML-P SAMLP SSO Identity Provider (IdP) Relying Party (RP) Authentication Metadata OIOSAML OIOSAML 2 OIOSAML 3 NemLogin NemLog-in 2 NemLog-in 3 ASP.NET MVC Core</PackageTags>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageIconUrl>https://itfoxtec.com/favicon.ico</PackageIconUrl>
<AssemblyVersion>4.10.9.3</AssemblyVersion>
<FileVersion>4.10.9.3</FileVersion>
<Copyright>Copyright © 2023</Copyright>
<Version>4.10.9-beta3</Version>
<AssemblyVersion>4.11.0</AssemblyVersion>
<FileVersion>4.11.0</FileVersion>
<Copyright>Copyright © 2024</Copyright>
<Version>4.11.0</Version>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ITfoxtec.SAML2.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
Expand Down
14 changes: 7 additions & 7 deletions src/ITfoxtec.Identity.Saml2/ITfoxtec.Identity.Saml2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ Support the Danish NemLog-in 2 / OIOSAML 2 and NemLog-in 3 / OIOSAML 3.</Descrip
<PackageTags>SAML SAML 2.0 SAML2.0 SAML2 SAML 2 SAML-P SAMLP SSO Identity Provider (IdP) Relying Party (RP) Authentication Metadata OIOSAML OIOSAML 2 OIOSAML 3 NemLogin NemLog-in 2 NemLog-in 3</PackageTags>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageIconUrl>https://itfoxtec.com/favicon.ico</PackageIconUrl>
<AssemblyVersion>4.10.9.3</AssemblyVersion>
<FileVersion>4.10.9.3</FileVersion>
<Copyright>Copyright © 2023</Copyright>
<Version>4.10.9-beta3</Version>
<AssemblyVersion>4.11.0</AssemblyVersion>
<FileVersion>4.11.0</FileVersion>
<Copyright>Copyright © 2024</Copyright>
<Version>4.11.0</Version>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>ITfoxtec.SAML2.snk</AssemblyOriginatorKeyFile>
<DelaySign>false</DelaySign>
Expand All @@ -43,9 +43,9 @@ Support the Danish NemLog-in 2 / OIOSAML 2 and NemLog-in 3 / OIOSAML 3.</Descrip

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0'">
<PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens.Saml" Version="7.0.3" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.5.0" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="8.0.0" />
<PackageReference Include="Microsoft.IdentityModel.Tokens.Saml" Version="7.6.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="7.6.0" />
<PackageReference Include="System.Security.Cryptography.Xml" Version="8.0.1" />
<PackageReference Include="System.ServiceModel.Security" Version="6.0.0" />
</ItemGroup>
<PropertyGroup Condition=" '$(TargetFramework)' == 'net8.0'">
Expand Down
4 changes: 3 additions & 1 deletion src/ITfoxtec.Identity.Saml2/Request/Saml2ArtifactResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ protected override XmlElement GetAssertionElement()

private XmlElement GetAssertionElementReference()
{
var assertionElements = GetInnerArtifactElementXml().SelectNodes($"//*[local-name()='{Schemas.Saml2Constants.Message.Assertion}']");
// Select all Assertion elements in the document that are at the top of their respective Assertion hierarchy.
// If the document contains <Assertion><Assertion></Assertion></Assertion> only the outer (hierarchical parent) Assertion is selected.
var assertionElements = GetInnerArtifactElementXml().SelectNodes($"//*[local-name()='{Schemas.Saml2Constants.Message.Assertion}']/ancestor-or-self::*[local-name()='{Schemas.Saml2Constants.Message.Assertion}'][last()]");
if (assertionElements.Count != 1)
{
throw new Saml2RequestException("There is not exactly one Assertion element in the inner Artifact element.");
Expand Down
4 changes: 3 additions & 1 deletion src/ITfoxtec.Identity.Saml2/Request/Saml2AuthnResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,9 @@ protected override XmlElement GetAssertionElement()

protected XmlElement GetAssertionElementReference()
{
var assertionElements = XmlDocument.DocumentElement.SelectNodes($"//*[local-name()='{Schemas.Saml2Constants.Message.Assertion}']");
// Select all Assertion elements in the document that are at the top of their respective Assertion hierarchy.
// If the document contains <Assertion><Assertion></Assertion></Assertion> only the outer (hierarchical parent) Assertion is selected.
var assertionElements = XmlDocument.DocumentElement.SelectNodes($"//*[local-name()='{Schemas.Saml2Constants.Message.Assertion}']/ancestor-or-self::*[local-name()='{Schemas.Saml2Constants.Message.Assertion}'][last()]");
if (assertionElements.Count != 1)
{
throw new Saml2RequestException("There is not exactly one Assertion element. Maybe the response is encrypted (set the Saml2Configuration.DecryptionCertificate).");
Expand Down

0 comments on commit a8da2c1

Please sign in to comment.