Revert "Test host: bind Kestrel to Site:Authority instead of dynamic port"
This reverts commit 402bcc1db8.
This commit is contained in:
parent
1ab0bef9a4
commit
09604092c5
3 changed files with 17 additions and 76 deletions
|
|
@ -1,7 +1,6 @@
|
|||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Net.Security;
|
||||
using IdentityModel.Client;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Yavsc.Org.Tests
|
||||
{
|
||||
|
|
@ -25,43 +24,7 @@ namespace Yavsc.Org.Tests
|
|||
|
||||
HttpClient client = NewHttpClient();
|
||||
var disco = await client.GetDiscoveryDocumentAsync(serverUrl);
|
||||
if (disco.IsError)
|
||||
{
|
||||
// Diagnostic 2026-07-12 : capture the raw HTTP response
|
||||
// AND dump the OIDC-related DB state so we can pinpoint
|
||||
// which state is corrupt when the discovery is broken.
|
||||
var rawResp = await client.GetAsync(serverUrl + "/.well-known/openid-configuration");
|
||||
var body = await rawResp.Content.ReadAsStringAsync();
|
||||
|
||||
string dbState = "no logger";
|
||||
try
|
||||
{
|
||||
using var scope = _serverFixture.Services.CreateScope();
|
||||
var cfg = scope.ServiceProvider
|
||||
.GetRequiredService<IdentityServer8.EntityFramework.DbContexts.ConfigurationDbContext>();
|
||||
var clients = cfg.Clients.Select(c => new {
|
||||
c.Id, c.ClientId, c.Enabled, c.RequireClientSecret
|
||||
}).ToList();
|
||||
var apiScopes = cfg.ApiScopes.Select(s => new { s.Name, s.Enabled }).ToList();
|
||||
var apiResources = cfg.ApiResources.Select(r => new { r.Name, r.Enabled }).ToList();
|
||||
var identityResources = cfg.IdentityResources.Select(r => new { r.Name, r.Enabled }).ToList();
|
||||
dbState = $"clients={System.Text.Json.JsonSerializer.Serialize(clients)}\n" +
|
||||
$"apiScopes={System.Text.Json.JsonSerializer.Serialize(apiScopes)}\n" +
|
||||
$"apiResources={System.Text.Json.JsonSerializer.Serialize(apiResources)}\n" +
|
||||
$"identityResources={System.Text.Json.JsonSerializer.Serialize(identityResources)}";
|
||||
}
|
||||
catch (Exception dumpEx)
|
||||
{
|
||||
dbState = $"dump failed: {dumpEx.Message}";
|
||||
}
|
||||
|
||||
throw new Exception(
|
||||
$"disco.Error={disco.Error}\n" +
|
||||
$"HTTP status={(int)rawResp.StatusCode}\n" +
|
||||
$"Body[0..2000]:\n{body.Substring(0, Math.Min(2000, body.Length))}\n" +
|
||||
$"---\n" +
|
||||
$"OIDC DB state at failure:\n{dbState}");
|
||||
}
|
||||
if (disco.IsError) throw new Exception(disco.Error);
|
||||
|
||||
var response = await client.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue