-
Notifications
You must be signed in to change notification settings - Fork 401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[merge after .NET 9 GA] Use new Base64Url API #2817
base: dev
Are you sure you want to change the base?
Conversation
@msbw2 Can you post a before / after of this benchmark as well here: JsonWebTokenHandler_ValidateTokenAsyncWithTVP ? Would be good to see the difference at that level. |
4abfe06
to
9b9b583
Compare
src/Microsoft.IdentityModel.Tokens/Microsoft.IdentityModel.Tokens.csproj
Outdated
Show resolved
Hide resolved
Benchmarks are here: #2828 (comment) |
9b9b583
to
615df8a
Compare
9e2ff23
to
b1d4eed
Compare
Base64UrlEncoderTests: | ||
application: | ||
job: benchmarks | ||
variables: | ||
filterArg: "*Base64UrlEncoderTests*" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a benefit on running these benchmarks in builds? I think these are good to run right now to verify the work. Any perf regressions to encoding/decoding should be caught by other validation benchmarks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think they are today, correct? If not, let's open an issue figure out prioritization.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, these are new tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, but no benchmarks are run today as part of the PR builds, correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think so.
168bfe8
to
08c0f25
Compare
73666d5
to
55946bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -177,47 +120,68 @@ public static byte[] DecodeBytes(string str) | |||
return Decode(str.AsSpan()); | |||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we have tests for this DecodeBytes(string str)
? We use it everywhere but maybe good to have explicit tests like in Base64UrlEncoderTests?
Same questions for Decode(string arg)
below.
test/Microsoft.IdentityModel.Tokens.Tests/Base64UrlEncodingTests.cs
Outdated
Show resolved
Hide resolved
55946bb
to
4ddc291
Compare
4ddc291
to
438a1f1
Compare
@@ -11,6 +11,7 @@ | |||
<SystemMemoryVersion>4.5.5</SystemMemoryVersion> | |||
<SystemSecurityCryptographyCngVersion>4.5.0</SystemSecurityCryptographyCngVersion> | |||
<SystemTextJson>8.0.4</SystemTextJson> | |||
<MicrosoftBclMemory>9.0.0-rc.1.24431.7</MicrosoftBclMemory> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't take an rc package in targets other than net9.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'd have to conditionally add it. @msbw2 let's park this to the .NET 9 release in Nov.
Coverage is good Base64UrlEncoder at 89% https://identitydivision.visualstudio.com/IDDP/_build/results?buildId=1366079&view=codecoverage-tab |
@@ -17,11 +18,9 @@ namespace Microsoft.IdentityModel.Tokens | |||
/// </summary> | |||
public static class Base64UrlEncoder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static class Base64UrlEncoder | |
[Obsolete("This class is obsolete and will be removed in a future release. Use System.Buffers.Text.Base64Url instead")] | |
public static class Base64UrlEncoder |
Should this class (and all methods) be marked as obsolete?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would be nice, but unfortunately there's some quirks about this class and the various methods that don't match exactly with the Base64Url
API, so I'm not entirely sure that's feasible. I've seen quite a few usages of this downstream that probably wouldn't be able to migrate easily.
Use the new
Base64Url
API.