Skip to content

[2515] dotnet10 migration - #2

Open
strongmindsaln wants to merge 24 commits into
masterfrom
feature/kitosudv-2515-dotnet10-migration
Open

[2515] dotnet10 migration#2
strongmindsaln wants to merge 24 commits into
masterfrom
feature/kitosudv-2515-dotnet10-migration

Conversation

@strongmindsaln

Copy link
Copy Markdown

No description provided.

strongmindsmhs and others added 10 commits February 27, 2025 08:23
- Convert all project files (dk.nita.saml20, dk.nita.test.saml20, ext.audit.log4net, ext.sessionstore.sqlserver) to SDK-style targeting net10.0
- Update IntegrationTest project to net10.0 with updated package versions
- Remove WebsiteDemo and IdentityProviderDemo from solution (Web Forms incompatible with .NET 10)
- Replace System.Web with Microsoft.AspNetCore.Http throughout all source files
- Replace System.Web.Caching with SamlMemoryCache helper (IMemoryCache-based)
- Replace HttpContext.Current with SamlHttpContextAccessor (IHttpContextAccessor-based)
- Replace System.IdentityModel.Selectors X509CertificateValidator with X509Chain
- Replace System.Web.Security.FormsAuthentication with no-ops (auth handled by host app)
- Replace System.Web.UI.Page in HttpPostBindingBuilder with direct HTML response writing
- Replace System.Data.SqlClient with Microsoft.Data.SqlClient
- Replace HttpUtility with System.Net.WebUtility throughout
- Rewrite BasePage, ErrorPage, SelectSaml20IDP as non-WebForms classes
- Rewrite SessionStore to use ASP.NET Core cookies (CookieOptions)
- Replace Response.End() calls (not available in ASP.NET Core)
- Remove IHttpHandler/IRequiresSessionState from AbstractEndpointHandler
- Add SamlHttpContextAccessor, SamlMemoryCache, HttpContextExtensions utility classes
- Update NUnit from 2.6.4 to 3.14.0 in test project
- Update assembly references in test app.config to kitos.dk.nita.saml20

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…hrows<>()

- ArtifactTest.cs: wrap CreateError1/2 and ParseError1/2/3 with Assert.Throws<ArgumentException>
- SignatureTest.cs: wrap DeserializeToken calls with Assert.Throws<Saml20Exception>,
  wrap Saml20Assertion constructor in TestSigning_04 with Assert.Throws<InvalidOperationException>
- XmlSignatureUtilsTest.cs: wrap DetectSignature_02 and CheckSignature_01 with Assert.Throws<InvalidOperationException>
- DKSAML20ProfileValidationTest.cs: wrap assertion.Validate() calls with Assert.Throws<DKSaml20FormatException>
- EncryptedAssertionTest.cs: wrap SessionKeyAlgorithm assignment in Assert.Throws<ArgumentException>
- Saml20CoreValidationTest.cs: wrap 65 invalid-input test methods with Assert.Throws<Saml20FormatException>
- GlobalTestSetup.cs: add assembly-level SetUpFixture to load FederationConfig/SAML20FederationConfig
  from the dll.config file, working around ConfigurationManager limitations in .NET 10
- app.config: remove deprecated system.web section and old .NET 4.7.2 startup element
- Saml20EncryptedAssertion.cs: fix Decrypt() to use standard EncryptedXml for non-GCM algorithms

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ssertion

- Replace RSACryptoServiceProvider casts with RSA base class in all SignatureProvider
  subclasses; use RSA.SignData/VerifyData with HashAlgorithmName instead of
  provider-specific APIs
- Remove Windows-only ConvertProviderType (CspKeyContainerInfo not available in .NET 10)
- Fix Saml20EncryptedAssertion.Decrypt() to fall back to EncryptedXml.DecryptData()
  for non-AES-GCM algorithms (AES-CBC, 3DES used in existing test assertions)
- Fix null-ref in ToSymmetricKey when EncryptedKey.EncryptionMethod is absent

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/dk.nita.saml20/dk.nita.saml20/Protocol/Saml20LogoutHandler.cs Dismissed
strongmindsaln and others added 14 commits April 8, 2026 12:17
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Triggers on v* tags. Requires NUGET_API_KEY repository secret.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fixes cross-site POST-back session loss (SameSite cookie issue):
- Embed session ID in RelayState on AuthnRequest (BuildRelayState)
- Recover session from RelayState on POST-back (TryRecoverSessionFromRelayState)
- Pin HttpContext via AsyncLocal in Saml20AbstractEndpointHandler
  so IHttpContextAccessor is reliable during the SSO callback

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The browser blocks the saml-session cookie on a cross-site POST (IdP
post-back) due to SameSite restrictions, so the cookie is absent when
the browser follows the 302 redirect to GET /SSO.

Fix:
- SessionStore.RefreshSessionCookie(): re-writes the existing session
  cookie into the current response.  Called from DoLogin() after the
  SAML assertion is stored so the 302 POST-response carries a fresh
  Set-Cookie header.  The browser then sends this cookie on the
  subsequent same-site GET /SSO request.

Also fix:
- Saml20AbstractEndpointHandler.ProcessRequest: guard against calling
  Handle() when CheckConfiguration() already rendered an error page
  (validated==false) — prevents WriteSessionCookie() being invoked
  after the response has started.

Bump version to 1.1.8.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants