From 0768b2fb73d3f6f4ec687f9f4701ba876b364857 Mon Sep 17 00:00:00 2001 From: Brett Hazen <2651260+bhazen@users.noreply.github.com> Date: Thu, 8 May 2025 13:03:23 -0500 Subject: [PATCH] Dotnet format on recently changed files in jwtbearer extensions --- .../DPoP/DPoPJwtBearerEvents.cs | 2 +- .../DPoP/DPoPProofValidator.cs | 10 +++++----- .../DPoP/PayloadTests.cs | 12 ++++++------ .../DPoPIntegrationTests.cs | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/aspnetcore-authentication-jwtbearer/src/AspNetCore.Authentication.JwtBearer/DPoP/DPoPJwtBearerEvents.cs b/aspnetcore-authentication-jwtbearer/src/AspNetCore.Authentication.JwtBearer/DPoP/DPoPJwtBearerEvents.cs index b9b0903fb..1c5ef1ca7 100644 --- a/aspnetcore-authentication-jwtbearer/src/AspNetCore.Authentication.JwtBearer/DPoP/DPoPJwtBearerEvents.cs +++ b/aspnetcore-authentication-jwtbearer/src/AspNetCore.Authentication.JwtBearer/DPoP/DPoPJwtBearerEvents.cs @@ -77,7 +77,7 @@ internal class DPoPJwtBearerEvents context.Fail("Multiple DPoP headers found"); return; } - + proofToken = dPopHeader.First()!; } else diff --git a/aspnetcore-authentication-jwtbearer/src/AspNetCore.Authentication.JwtBearer/DPoP/DPoPProofValidator.cs b/aspnetcore-authentication-jwtbearer/src/AspNetCore.Authentication.JwtBearer/DPoP/DPoPProofValidator.cs index 238ffb35a..f048dee75 100644 --- a/aspnetcore-authentication-jwtbearer/src/AspNetCore.Authentication.JwtBearer/DPoP/DPoPProofValidator.cs +++ b/aspnetcore-authentication-jwtbearer/src/AspNetCore.Authentication.JwtBearer/DPoP/DPoPProofValidator.cs @@ -339,12 +339,12 @@ internal class DPoPProofValidator : IDPoPProofValidator { var uri1 = new Uri(requestedUri); var uri2 = new Uri(htuValue); - + return Uri.Compare( - uri1, - uri2, - UriComponents.Scheme | UriComponents.HostAndPort | UriComponents.Path, - UriFormat.SafeUnescaped, + uri1, + uri2, + UriComponents.Scheme | UriComponents.HostAndPort | UriComponents.Path, + UriFormat.SafeUnescaped, StringComparison.OrdinalIgnoreCase) == 0; } catch (UriFormatException) diff --git a/aspnetcore-authentication-jwtbearer/test/AspNetCore.Authentication.JwtBearer.Tests/DPoP/PayloadTests.cs b/aspnetcore-authentication-jwtbearer/test/AspNetCore.Authentication.JwtBearer.Tests/DPoP/PayloadTests.cs index d6ed82da6..429ccf847 100644 --- a/aspnetcore-authentication-jwtbearer/test/AspNetCore.Authentication.JwtBearer.Tests/DPoP/PayloadTests.cs +++ b/aspnetcore-authentication-jwtbearer/test/AspNetCore.Authentication.JwtBearer.Tests/DPoP/PayloadTests.cs @@ -94,7 +94,7 @@ public class PayloadTests : DPoPProofValidatorTestBase Result.ShouldBeInvalidProofWithDescription("Invalid 'htu' value."); ProofValidator.ReplayCacheShouldNotBeCalled(); } - + [Theory] [InlineData("https://example.com?query=1#fragment")] [InlineData("https://example.com/#fragment")] @@ -113,10 +113,10 @@ public class PayloadTests : DPoPProofValidatorTestBase ProofValidator.TestTimeProvider.SetUtcNow(DateTimeOffset.FromUnixTimeSeconds(IssuedAt)); ProofValidator.ValidatePayload(Context, Result); - + Result.IsError.ShouldBeFalse(Result.ErrorDescription); } - + [Theory] [InlineData("https://example.com")] [InlineData("HTTPS://EXAMPLE.COM")] @@ -136,10 +136,10 @@ public class PayloadTests : DPoPProofValidatorTestBase ProofValidator.TestTimeProvider.SetUtcNow(DateTimeOffset.FromUnixTimeSeconds(IssuedAt)); ProofValidator.ValidatePayload(Context, Result); - + Result.IsError.ShouldBeFalse(Result.ErrorDescription); } - + [Theory] [InlineData("https://example.com", "https://example.com:443")] [InlineData("http://example.com", "http://example.com:80")] @@ -158,7 +158,7 @@ public class PayloadTests : DPoPProofValidatorTestBase ProofValidator.TestTimeProvider.SetUtcNow(DateTimeOffset.FromUnixTimeSeconds(IssuedAt)); ProofValidator.ValidatePayload(Context, Result); - + Result.IsError.ShouldBeFalse(Result.ErrorDescription); } diff --git a/aspnetcore-authentication-jwtbearer/test/AspNetCore.Authentication.JwtBearer.Tests/DPoPIntegrationTests.cs b/aspnetcore-authentication-jwtbearer/test/AspNetCore.Authentication.JwtBearer.Tests/DPoPIntegrationTests.cs index eec56dad8..f4e83d6af 100644 --- a/aspnetcore-authentication-jwtbearer/test/AspNetCore.Authentication.JwtBearer.Tests/DPoPIntegrationTests.cs +++ b/aspnetcore-authentication-jwtbearer/test/AspNetCore.Authentication.JwtBearer.Tests/DPoPIntegrationTests.cs @@ -65,11 +65,11 @@ public class DPoPIntegrationTests(ITestOutputHelper testOutputHelper) identityServer.Clients.Add(DPoPOnlyClient); var jwk = CreateJwk(); var api = await CreateDPoPApi(); - + var app = new AppHost(identityServer, api, "client1", testOutputHelper, configureUserTokenManagementOptions: opt => opt.DPoPJsonWebKey = jwk); await app.Initialize(); - + // Login and get token for api call await app.LoginAsync("sub"); var response = await app.BrowserClient.GetAsync(app.Url("/user_token")); @@ -91,7 +91,7 @@ public class DPoPIntegrationTests(ITestOutputHelper testOutputHelper) }); proof.ShouldNotBeNull(); api.HttpClient.DefaultRequestHeaders.Add(OidcConstants.HttpHeaders.DPoP, [proof.ProofToken, proof.ProofToken]); - + var result = await api.HttpClient.GetAsync("/"); result.StatusCode.ShouldBe(HttpStatusCode.Unauthorized); @@ -164,7 +164,7 @@ public class DPoPIntegrationTests(ITestOutputHelper testOutputHelper) token.AccessToken.ShouldNotBeNull(); token.DPoPJsonWebKey.ShouldNotBeNull(); api.HttpClient.SetToken("DPoP", token.AccessToken); - + var result = await api.HttpClient.GetAsync("/"); result.StatusCode.ShouldBe(HttpStatusCode.Unauthorized);