Fix passkey RPID mismatch across environments
Derive ServerDomain and Origin from the incoming HTTP request instead of appsettings.json, so WebAuthn works on localhost, dev, and production without any environment-specific configuration. Removed IFido2 from DI and the Fido2 appsettings block — PasskeyController instantiates Fido2 per-request via BuildFido2(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -290,16 +290,9 @@ builder.Services.AddSession(options =>
|
||||
// Add memory cache
|
||||
builder.Services.AddMemoryCache();
|
||||
|
||||
// Register Fido2/WebAuthn for passkey (biometric) login
|
||||
builder.Services.AddFido2(options =>
|
||||
{
|
||||
options.ServerDomain = builder.Configuration["Fido2:ServerDomain"] ?? "localhost";
|
||||
options.ServerName = builder.Configuration["Fido2:ServerName"] ?? "Powder Coating Logix";
|
||||
var origins = builder.Configuration.GetSection("Fido2:Origins").Get<HashSet<string>>();
|
||||
if (origins?.Count > 0) options.Origins = origins;
|
||||
options.TimestampDriftTolerance = int.Parse(
|
||||
builder.Configuration["Fido2:TimestampDriftTolerance"] ?? "300");
|
||||
});
|
||||
// Fido2/WebAuthn: no DI registration needed — PasskeyController builds a
|
||||
// per-request Fido2 instance from the incoming Host header so the RPID matches
|
||||
// automatically on every environment without config changes.
|
||||
|
||||
// Configure authorization policies for multi-tenancy
|
||||
builder.Services.AddAuthorization(options =>
|
||||
|
||||
Reference in New Issue
Block a user