-
Notifications
You must be signed in to change notification settings - Fork 409
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update YAML to build previews Add ReadOnlySpan overloads Add benchmark Add ValidateAndGetOutputSize for spans Remove duplication Update benchmark Remove duplicates Update Add benchmarks Update Replace ReadyOnlySpan with ReadOnlyMemory Update test Update benchmark naming Move ArrayPool to JsonWebToken level Update CreateHeaderClaimSet Update benchmark for JWE to resolve error Fix a typo (#2479) * update comment for azp in jsonwebtoken * removed extra words Link to breaking change announcement in IDX10506 (#2478) When an IDX10506 exception is thrown from JsonWebTokenHandler, there's a good chance this is due to a breaking change to ASP.NET Core 8. This adds a link to the breaking change announcement at https://learn.microsoft.com/en-us/dotnet/core/compatibility/aspnet-core/8.0/securitytoken-events 7.3.1 changelog (#2476) * 7.3.1 changelog * two additions * add space fix log message dup (#2481) Reduce duplication Fix comment Set _encodedTokenMemory as readonly Remove unnecessary private method Use Base64UrlEncoding.Decode with action Use ValidateAndGetOutputSize(ReadOnlySpan<char> strSpan..) thoughout Add tests Revert change Temporarily allow publishing to NuGet use just `1` for preview up version to 7.4.0 for preview Separate JWS and JWE benchmarks
- Loading branch information
Sruthi Keerthi Rangavajhula
committed
Feb 24, 2024
1 parent
131d476
commit 1b2845a
Showing
19 changed files
with
396 additions
and
136 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
benchmark/Microsoft.IdentityModel.Benchmarks/ReadJWETokenTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.IdentityModel.JsonWebTokens; | ||
using Microsoft.IdentityModel.Tokens; | ||
|
||
namespace Microsoft.IdentityModel.Benchmarks | ||
{ | ||
// dotnet run -c release -f net8.0 --filter Microsoft.IdentityModel.Benchmarks.ReadTokenTests* | ||
|
||
[Config(typeof(BenchmarkConfig))] | ||
[HideColumns("Type", "Job", "WarmupCount", "LaunchCount")] | ||
[MemoryDiagnoser] | ||
public class ReadJWETokenTests | ||
{ | ||
string _encryptedJWE; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
var jsonWebTokenHandler = new JsonWebTokenHandler(); | ||
var jweTokenDescriptor = new SecurityTokenDescriptor | ||
{ | ||
SigningCredentials = BenchmarkUtils.SigningCredentialsRsaSha256, | ||
EncryptingCredentials = BenchmarkUtils.EncryptingCredentialsAes256Sha512, | ||
TokenType = JwtHeaderParameterNames.Jwk, | ||
Claims = BenchmarkUtils.Claims | ||
}; | ||
|
||
_encryptedJWE = jsonWebTokenHandler.CreateToken(jweTokenDescriptor); | ||
} | ||
|
||
[Benchmark] | ||
public JsonWebToken ReadJWE_FromString() | ||
{ | ||
return new JsonWebToken(_encryptedJWE); | ||
} | ||
|
||
[Benchmark] | ||
public JsonWebToken ReadJWE_FromMemory() | ||
{ | ||
return new JsonWebToken(_encryptedJWE.AsMemory()); | ||
} | ||
} | ||
} |
47 changes: 47 additions & 0 deletions
47
benchmark/Microsoft.IdentityModel.Benchmarks/ReadJWSTokenTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using BenchmarkDotNet.Attributes; | ||
using Microsoft.IdentityModel.JsonWebTokens; | ||
using Microsoft.IdentityModel.Tokens; | ||
|
||
namespace Microsoft.IdentityModel.Benchmarks | ||
{ | ||
// dotnet run -c release -f net8.0 --filter Microsoft.IdentityModel.Benchmarks.ReadJWSTokenTests* | ||
|
||
[Config(typeof(BenchmarkConfig))] | ||
[HideColumns("Type", "Job", "WarmupCount", "LaunchCount")] | ||
[MemoryDiagnoser] | ||
[RankColumn] | ||
public class ReadJWSTokenTests | ||
{ | ||
string _encodedJWS; | ||
|
||
[GlobalSetup] | ||
public void Setup() | ||
{ | ||
var jsonWebTokenHandler = new JsonWebTokenHandler(); | ||
var jwsTokenDescriptor = new SecurityTokenDescriptor | ||
{ | ||
SigningCredentials = BenchmarkUtils.SigningCredentialsRsaSha256, | ||
TokenType = JwtHeaderParameterNames.Jwk, | ||
Claims = BenchmarkUtils.Claims | ||
}; | ||
|
||
_encodedJWS = jsonWebTokenHandler.CreateToken(jwsTokenDescriptor); | ||
} | ||
|
||
[Benchmark] | ||
public JsonWebToken ReadJWS_FromString() | ||
{ | ||
return new JsonWebToken(_encodedJWS); | ||
} | ||
|
||
[Benchmark] | ||
public JsonWebToken ReadJWS_FromMemory() | ||
{ | ||
return new JsonWebToken(_encodedJWS.AsMemory()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.