Dotnet format on recently changed files in jwtbearer extensions

This commit is contained in:
Brett Hazen 2025-05-08 13:03:23 -05:00
parent b6da2c191c
commit 0768b2fb73
4 changed files with 16 additions and 16 deletions

View file

@ -77,7 +77,7 @@ internal class DPoPJwtBearerEvents
context.Fail("Multiple DPoP headers found");
return;
}
proofToken = dPopHeader.First()!;
}
else

View file

@ -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)

View file

@ -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);
}

View file

@ -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);