Open
Description
The IdP we are integrating with is responding with a SAML Response with IssueInstant having 9 digits of second precision. I do not have the ability to modify the IdP unfortunately do not see a way to ignore the additional digits in this library. I am looking for a workaround for how to gracefully handle these responses as they currently cause the Assertion to be rejected. Any guidance for how to best work around this issue would be fantastic! Current stack trace is provided
2025-03-06 16:18:06.598 +00:00 [Debug] (Sustainsys.Saml2.AspNetCore2.Saml2Handler) Signature validation passed for Saml Response _f1ea718e-eabf-491f-a0fe-da1f84242499
2025-03-06 16:18:06.621 +00:00 [Error] (Wkc.Cbw.Web.Middleware.HttpStatusCodeExceptionMiddleware) Http Status Code Exception Middleware "IDX13102: Exception thrown while reading '[PII is hidden]' for Saml2SecurityToken. Inner exception: 'System.FormatException'."
Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenReadException: IDX13102: Exception thrown while reading '[PII is hidden]' for Saml2SecurityToken. Inner exception: 'System.FormatException'.
---> System.FormatException: String '2025-03-06T16:18:06.642345458Z' was not recognized as a valid DateTime.
at Sustainsys.Saml2.Saml2P.Saml2PSerializer.ReadAssertion(XmlReader reader)
--- End of inner exception stack trace ---
at Sustainsys.Saml2.Saml2P.Saml2PSerializer.ReadAssertion(XmlReader reader)
at Microsoft.IdentityModel.Tokens.Saml2.Saml2SecurityTokenHandler.ReadSaml2Token(String token)
at Sustainsys.Saml2.Saml2P.Saml2PSecurityTokenHandler.ValidateToken(String token, TokenValidationParameters validationParameters, SecurityToken& validatedToken)
at Sustainsys.Saml2.Saml2P.Saml2Response.CreateClaims(IOptions options, IdentityProvider idp)+MoveNext()
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at Sustainsys.Saml2.Saml2P.Saml2Response.GetClaims(IOptions options, IDictionary`2 relayData)
at Sustainsys.Saml2.WebSso.AcsCommand.ProcessResponse(IOptions options, Saml2Response samlResponse, StoredRequestState storedRequestState, IdentityProvider identityProvider, String relayState)
at Sustainsys.Saml2.WebSso.AcsCommand.Run(HttpRequestData request, IOptions options)
at Sustainsys.Saml2.AspNetCore2.Saml2Handler.HandleRequestAsync()
at Microsoft.AspNetCore.Authentication.AuthenticationMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Microsoft.AspNetCore.Session.SessionMiddleware.Invoke(HttpContext context)
at Wkc.Cbw.Web.Middleware.HttpStatusCodeExceptionMiddleware.Invoke(HttpContext context) in /src/Wkc.Cbw.Web/Middleware/HttpStatusCodeExceptionMiddleware.cs:line 58