Fix logout test support compile errors
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
404dafdd40
commit
69b670e3af
2 changed files with 6 additions and 5 deletions
|
|
@ -13,7 +13,7 @@ namespace Bifrost.Web.Tests;
|
||||||
public sealed class OidcLogoutTests
|
public sealed class OidcLogoutTests
|
||||||
{
|
{
|
||||||
private static readonly TimeSpan[] ExpectedBackoff =
|
private static readonly TimeSpan[] ExpectedBackoff =
|
||||||
[30, 60, 120, 240, 480, 900, 900].Select(x => TimeSpan.FromSeconds(x)).ToArray();
|
new[] { 30, 60, 120, 240, 480, 900, 900 }.Select(x => TimeSpan.FromSeconds(x)).ToArray();
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
public async Task Probe_authorizations_carry_the_subject_and_a_valid_status_after_a_code_flow()
|
public async Task Probe_authorizations_carry_the_subject_and_a_valid_status_after_a_code_flow()
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ using System.Net.Http.Json;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using Bifrost.Web.Configuration;
|
||||||
using Bifrost.Web.Data;
|
using Bifrost.Web.Data;
|
||||||
using Bifrost.Web.Domain;
|
using Bifrost.Web.Domain;
|
||||||
using Bifrost.Web.Features.Oidc;
|
using Bifrost.Web.Features.Oidc;
|
||||||
|
|
@ -136,7 +137,7 @@ public sealed class OidcLogoutFactory : OidcWebApplicationFactory
|
||||||
Time,
|
Time,
|
||||||
NullLogger<OidcLogoutReconciler>.Instance);
|
NullLogger<OidcLogoutReconciler>.Instance);
|
||||||
|
|
||||||
public WebApplicationFactoryClientOptions ClientOptions() => new()
|
public WebApplicationFactoryClientOptions HostClientOptions() => new()
|
||||||
{
|
{
|
||||||
AllowAutoRedirect = false,
|
AllowAutoRedirect = false,
|
||||||
HandleCookies = true,
|
HandleCookies = true,
|
||||||
|
|
@ -146,7 +147,7 @@ public sealed class OidcLogoutFactory : OidcWebApplicationFactory
|
||||||
/// <summary>Registers a member, sets <paramref name="status"/>, and completes one authorization-code flow for them.</summary>
|
/// <summary>Registers a member, sets <paramref name="status"/>, and completes one authorization-code flow for them.</summary>
|
||||||
public async Task<(string Identity, string IdToken)> GrantAsync(MembershipStatus status = MembershipStatus.Active)
|
public async Task<(string Identity, string IdToken)> GrantAsync(MembershipStatus status = MembershipStatus.Active)
|
||||||
{
|
{
|
||||||
using var client = CreateClient(ClientOptions());
|
using var client = CreateClient(HostClientOptions());
|
||||||
var identity = $"member-{Guid.NewGuid():N}";
|
var identity = $"member-{Guid.NewGuid():N}";
|
||||||
using (var register = await client.PostAsJsonAsync("/auth/bifrost/register", new { identity, displayName = identity }))
|
using (var register = await client.PostAsJsonAsync("/auth/bifrost/register", new { identity, displayName = identity }))
|
||||||
{
|
{
|
||||||
|
|
@ -174,7 +175,7 @@ public sealed class OidcLogoutFactory : OidcWebApplicationFactory
|
||||||
var code = QueryHelpers.ParseQuery(response.Headers.Location!.Query)["code"].ToString();
|
var code = QueryHelpers.ParseQuery(response.Headers.Location!.Query)["code"].ToString();
|
||||||
response.Dispose();
|
response.Dispose();
|
||||||
|
|
||||||
using var bare = CreateClient(ClientOptions());
|
using var bare = CreateClient(HostClientOptions());
|
||||||
using var exchange = new HttpRequestMessage(HttpMethod.Post, "/connect/token")
|
using var exchange = new HttpRequestMessage(HttpMethod.Post, "/connect/token")
|
||||||
{
|
{
|
||||||
Content = new FormUrlEncodedContent(new Dictionary<string, string>
|
Content = new FormUrlEncodedContent(new Dictionary<string, string>
|
||||||
|
|
@ -215,7 +216,7 @@ public sealed class OidcLogoutFactory : OidcWebApplicationFactory
|
||||||
|
|
||||||
public async Task<JsonWebKeySet> JwksAsync()
|
public async Task<JsonWebKeySet> JwksAsync()
|
||||||
{
|
{
|
||||||
using var client = CreateClient(ClientOptions());
|
using var client = CreateClient(HostClientOptions());
|
||||||
return new JsonWebKeySet(await client.GetStringAsync("/.well-known/jwks"));
|
return new JsonWebKeySet(await client.GetStringAsync("/.well-known/jwks"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue