You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For every string claim in the JWT, we are calling DateTime.TryParse on each value, whether it is expected to be a DateTime or not. This is expensive. We should consider if can eliminate these calls, or only call them if necessary.
The text was updated successfully, but these errors were encountered:
@eerhardt Excellent find, this was added for backcompat.
We should state what claims we will consider as a possible datetime, ignore the rest.
I think we need to wrap this in a AppContext switch as we could break users.
We are investigating an API that will give users the ability to step in front of property claim.
When that API is ready, users will be able to handle specific claims.
Which version of Microsoft.IdentityModel are you using?
latest version.
Where is the issue?
Repro
Looking at a CPU profile of validating JWT tokens, between 5-8% of the time is spent in 2 calls to
DateTime.TryParse
:azure-activedirectory-identitymodel-extensions-for-dotnet/src/Microsoft.IdentityModel.Tokens/Json/JsonSerializerPrimitives.cs
Line 713 in 753959a
azure-activedirectory-identitymodel-extensions-for-dotnet/src/Microsoft.IdentityModel.JsonWebTokens/JwtTokenUtilities.cs
Lines 602 to 604 in 753959a
For every string claim in the JWT, we are calling
DateTime.TryParse
on each value, whether it is expected to be a DateTime or not. This is expensive. We should consider if can eliminate these calls, or only call them if necessary.The text was updated successfully, but these errors were encountered: