Running Sustainsys SAML2 on .NET 6 throws the following exception:
System.InvalidCastException: Unable to cast object of type 'RSASecurityTransforms' to type 'System.Security.Cryptography.RSACryptoServiceProvider'.
at Sustainsys.Saml2.WebSso.Saml2RedirectBinding.AddSignature(String queryString, ISaml2Message message)
at Sustainsys.Saml2.WebSso.Saml2RedirectBinding.Bind[TMessage](TMessage message, ILoggerAdapter logger, Action`3 xmlCreatedNotification)
at Sustainsys.Saml2.IdentityProvider.Bind[TMessage](TMessage message, Action`3 xmlCreatedNotification)
at Sustainsys.Saml2.WebSso.SignInCommand.InitiateLoginToIdp(IOptions options, IDictionary`2 relayData, Saml2Urls urls, IdentityProvider idp, Uri returnUrl, HttpRequestData request)
at Sustainsys.Saml2.WebSso.SignInCommand.Run(EntityId idpEntityId, String returnPath, HttpRequestData request, IOptions options, IDictionary`2 relayData)
at Sustainsys.Saml2.AspNetCore2.Saml2Handler.ChallengeAsync(AuthenticationProperties properties)
at Microsoft.AspNetCore.Authentication.AuthenticationService.ChallengeAsync(HttpContext context, String scheme, AuthenticationProperties properties)
The runtime detection logic in EnvironmentHelpers.IsNetCore doesn't account for versions higher than .NET 5.
Also, X509Certificate2.Private is now obsolete in .NET 6. The recommendation is to use X509Certificate2.GetRSAPrivateKey
Running Sustainsys SAML2 on .NET 6 throws the following exception:
The runtime detection logic in
EnvironmentHelpers.IsNetCore
doesn't account for versions higher than .NET 5. Also,X509Certificate2.Private
is now obsolete in .NET 6. The recommendation is to useX509Certificate2.GetRSAPrivateKey
Sustainsys SAML2 version:
2.8.0
.