From 0d4d1cedddbed8ffd1540a44f12a050c4afbcccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anders=20=C3=85berg?= Date: Mon, 8 Dec 2025 19:42:28 +0100 Subject: [PATCH] Rename ServerDomain -> RPID --- BlazorWasmDemo/Server/Program.cs | 4 +- Demo/ConformanceTestController.cs | 4 +- Demo/Program.cs | 6 +- Src/Fido2.Models/AssertionOptions.cs | 2 +- Src/Fido2.Models/CredentialCreateOptions.cs | 2 +- Src/Fido2.Models/Fido2Configuration.cs | 4 +- .../AddFido2ExtensionTests.cs | 22 ++-- Tests/Fido2.Tests/Attestation/Apple.cs | 4 +- Tests/Fido2.Tests/AuthenticatorResponse.cs | 120 +++++++++--------- Tests/Fido2.Tests/Fido2Tests.cs | 8 +- 10 files changed, 88 insertions(+), 88 deletions(-) diff --git a/BlazorWasmDemo/Server/Program.cs b/BlazorWasmDemo/Server/Program.cs index 23a9c970..5106d979 100644 --- a/BlazorWasmDemo/Server/Program.cs +++ b/BlazorWasmDemo/Server/Program.cs @@ -7,8 +7,8 @@ var origin = new Uri(builder.Configuration["Origin"]!); builder.Services.AddFido2(options => { - options.ServerDomain = origin.Host; - options.ServerName = "FIDO2 Server"; + options.RPID = origin.Host; + options.RPName = "FIDO2 Server"; options.Origins = new HashSet { origin.AbsoluteUri }; options.TimestampDriftTolerance = 1000; }); diff --git a/Demo/ConformanceTestController.cs b/Demo/ConformanceTestController.cs index a10a8d62..421bd999 100644 --- a/Demo/ConformanceTestController.cs +++ b/Demo/ConformanceTestController.cs @@ -25,8 +25,8 @@ public ConformanceTestController(IOptions fido2Configuration _fido2 = new Fido2(new Fido2Configuration { - ServerDomain = fido2Configuration.Value.ServerDomain, - ServerName = fido2Configuration.Value.ServerName, + RPID = fido2Configuration.Value.RPID, + RPName = fido2Configuration.Value.RPName, Origins = fido2Configuration.Value.FullyQualifiedOrigins, }, ConformanceTesting.MetadataServiceInstance( diff --git a/Demo/Program.cs b/Demo/Program.cs index b39a4027..4a524369 100644 --- a/Demo/Program.cs +++ b/Demo/Program.cs @@ -29,10 +29,10 @@ builder.Services.AddFido2(options => { - options.ServerDomain = builder.Configuration["fido2:serverDomain"]; - options.ServerName = "FIDO2 Test"; + options.RPID = builder.Configuration["fido2:serverDomain"]; + options.RPName = "FIDO2 Test"; options.Origins = builder.Configuration.GetSection("fido2:origins").Get>(); - + // Other options available: options.TimestampDriftTolerance = builder.Configuration.GetValue("fido2:timestampDriftTolerance"); options.MDSCacheDirPath = builder.Configuration["fido2:MDSCacheDirPath"]; diff --git a/Src/Fido2.Models/AssertionOptions.cs b/Src/Fido2.Models/AssertionOptions.cs index 1160357f..f2c2daad 100644 --- a/Src/Fido2.Models/AssertionOptions.cs +++ b/Src/Fido2.Models/AssertionOptions.cs @@ -75,7 +75,7 @@ public static AssertionOptions Create( { Challenge = challenge, Timeout = config.Timeout, - RpId = config.ServerDomain, + RpId = config.RPID, AllowCredentials = allowedCredentials, UserVerification = userVerification, Extensions = extensions diff --git a/Src/Fido2.Models/CredentialCreateOptions.cs b/Src/Fido2.Models/CredentialCreateOptions.cs index 94e41c54..ce35c4e1 100644 --- a/Src/Fido2.Models/CredentialCreateOptions.cs +++ b/Src/Fido2.Models/CredentialCreateOptions.cs @@ -132,7 +132,7 @@ public static CredentialCreateOptions Create( return new CredentialCreateOptions { Challenge = challenge, - Rp = new PublicKeyCredentialRpEntity(config.ServerDomain, config.ServerName, config.ServerIcon), + Rp = new PublicKeyCredentialRpEntity(config.RPID, config.RPName, config.ServerIcon), Timeout = config.Timeout, User = user, PubKeyCredParams = pubKeyCredParams, diff --git a/Src/Fido2.Models/Fido2Configuration.cs b/Src/Fido2.Models/Fido2Configuration.cs index 686052e5..8116dc40 100644 --- a/Src/Fido2.Models/Fido2Configuration.cs +++ b/Src/Fido2.Models/Fido2Configuration.cs @@ -35,12 +35,12 @@ public Fido2Configuration() /// /// The effective domain of the RP. Should be unique and will be used as the identity for the RP. /// - public string ServerDomain { get; set; } + public string RPID { get; set; } /// /// A human-friendly name of the RP. /// - public string ServerName { get; set; } + public string RPName { get; set; } /// /// A serialized URL which resolves to an image associated with the entity. For example, this could be a user’s avatar or a Relying Party's logo. This URL MUST be an a priori authenticated URL. Authenticators MUST accept and store a 128-byte minimum length for an icon member’s value. Authenticators MAY ignore an icon member’s value if its length is greater than 128 bytes. The URL’s scheme MAY be "data" to avoid fetches of the URL, at the cost of needing more storage. diff --git a/Tests/Fido2.AspNet.Tests/AddFido2ExtensionTests.cs b/Tests/Fido2.AspNet.Tests/AddFido2ExtensionTests.cs index 4b4cddd2..f30a00dc 100644 --- a/Tests/Fido2.AspNet.Tests/AddFido2ExtensionTests.cs +++ b/Tests/Fido2.AspNet.Tests/AddFido2ExtensionTests.cs @@ -1,4 +1,4 @@ -using System; +using System; using Fido2NetLib; @@ -22,8 +22,8 @@ public void AddFido2_WithConfiguration_RegistersServices() var configuration = new ConfigurationBuilder() .AddInMemoryCollection(new Dictionary { - ["ServerName"] = "Test Server", - ["ServerDomain"] = "localhost", + ["RPName"] = "Test Server", + ["RPID"] = "localhost", ["Origins"] = "https://localhost:5001" }) .Build(); @@ -44,13 +44,13 @@ public void AddFido2_WithConfiguration_RegistersServices() // Verify Fido2Configuration can be resolved var config = serviceProvider.GetService(); Assert.NotNull(config); - Assert.Equal("Test Server", config.ServerName); - Assert.Equal("localhost", config.ServerDomain); + Assert.Equal("Test Server", config.RPName); + Assert.Equal("localhost", config.RPID); // Verify ISystemClock is registered var systemClock = serviceProvider.GetService(); Assert.NotNull(systemClock); - + // Verify MDS is null // var mds = serviceProvider.GetService(); // Assert.Null(mds); @@ -65,8 +65,8 @@ public void AddFido2_WithSetupAction_RegistersServices() // Act var builder = services.AddFido2(config => { - config.ServerName = "Action Server"; - config.ServerDomain = "example.com"; + config.RPName = "Action Server"; + config.RPID = "example.com"; config.Origins = new HashSet { "https://example.com" }; }); @@ -83,14 +83,14 @@ public void AddFido2_WithSetupAction_RegistersServices() // Verify Fido2Configuration can be resolved with correct values var config = serviceProvider.GetService(); Assert.NotNull(config); - Assert.Equal("Action Server", config.ServerName); - Assert.Equal("example.com", config.ServerDomain); + Assert.Equal("Action Server", config.RPName); + Assert.Equal("example.com", config.RPID); Assert.Contains("https://example.com", config.Origins); // Verify ISystemClock is registered var systemClock = serviceProvider.GetService(); Assert.NotNull(systemClock); - + // Verify MDS is null // var mds = serviceProvider.GetService(); // Assert.Null(mds); diff --git a/Tests/Fido2.Tests/Attestation/Apple.cs b/Tests/Fido2.Tests/Attestation/Apple.cs index 22ceaf1f..9bf87d5b 100644 --- a/Tests/Fido2.Tests/Attestation/Apple.cs +++ b/Tests/Fido2.Tests/Attestation/Apple.cs @@ -264,8 +264,8 @@ public async Task TestApplePublicKeyMismatch() var lib = new Fido2(new Fido2Configuration { - ServerDomain = "6cc3c9e7967a.ngrok.io", - ServerName = "6cc3c9e7967a.ngrok.io", + RPID = "6cc3c9e7967a.ngrok.io", + RPName = "6cc3c9e7967a.ngrok.io", Origins = new HashSet { "https://www.passwordless.dev" }, }); diff --git a/Tests/Fido2.Tests/AuthenticatorResponse.cs b/Tests/Fido2.Tests/AuthenticatorResponse.cs index e7aaf7c5..e28d568a 100644 --- a/Tests/Fido2.Tests/AuthenticatorResponse.cs +++ b/Tests/Fido2.Tests/AuthenticatorResponse.cs @@ -119,8 +119,8 @@ public async Task TestAuthenticatorOriginsAsync(string origin, string expectedOr var lib = new Fido2(new Fido2Configuration() { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { expectedOrigin }, }); @@ -225,8 +225,8 @@ public async Task TestAuthenticatorOriginsFail(string origin, string expectedOri var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { expectedOrigin }, }); @@ -442,8 +442,8 @@ public async Task TestAuthenticatorAttestationResponseInvalidType() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -517,8 +517,8 @@ public async Task TestAuthenticatorAttestationResponseInvalidRawId(string value, var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -590,8 +590,8 @@ public async Task TestAuthenticatorAttestationResponseInvalidRawType() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -670,8 +670,8 @@ public async Task TestAuthenticatorAttestationResponseRpidMismatch() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -752,8 +752,8 @@ public async Task TestAuthenticatorAttestationResponseNotUserPresentAsync() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -834,8 +834,8 @@ public async Task TestAuthenticatorAttestationResponseBackupEligiblePolicyRequir var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, }); @@ -915,8 +915,8 @@ public async Task TestAuthenticatorAttestationResponseBackupEligiblePolicyDisall var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Disallowed, }); @@ -996,8 +996,8 @@ public async Task TestAuthenticatorAttestationResponseNoAttestedCredentialData() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1077,8 +1077,8 @@ public async Task TestAuthenticatorAttestationResponseUnknownAttestationType() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1158,8 +1158,8 @@ public async Task TestAuthenticatorAttestationResponseNotUniqueCredId() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1238,8 +1238,8 @@ public async Task TestAuthenticatorAttestationResponseUVRequired() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1372,8 +1372,8 @@ public async Task TestAuthenticatorAssertionTypeNotPublicKey() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1447,8 +1447,8 @@ public async Task TestAuthenticatorAssertionIdMissing() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1523,8 +1523,8 @@ public async Task TestAuthenticatorAssertionRawIdMissing() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1599,8 +1599,8 @@ public async Task TestAuthenticatorAssertionUserHandleEmpty() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1675,8 +1675,8 @@ public async Task TestAuthenticatorAssertionUserHandleNotOwnerOfPublicKey() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1751,8 +1751,8 @@ public async Task TestAuthenticatorAssertionTypeNotWebAuthnGet() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1829,8 +1829,8 @@ public async Task TestAuthenticatorAssertionAppId() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1906,8 +1906,8 @@ public async Task TestAuthenticatorAssertionInvalidRpIdHash() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -1983,8 +1983,8 @@ public async Task TestAuthenticatorAssertionUPRequirementNotMet() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -2060,8 +2060,8 @@ public async Task TestAuthenticatorAssertionUVPolicyNotMet() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -2136,8 +2136,8 @@ public async Task TestAuthenticatorAssertionBEPolicyRequired() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -2212,8 +2212,8 @@ public async Task TestAuthenticatorAssertionBEPolicyDisallow() var lib = new Fido2(new Fido2Configuration { BackupEligibleCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Disallowed, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -2288,8 +2288,8 @@ public async Task TestAuthenticatorAssertionBSPolicyRequired() var lib = new Fido2(new Fido2Configuration { BackedUpCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Required, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -2364,8 +2364,8 @@ public async Task TestAuthenticatorAssertionBSPolicyDisallow() var lib = new Fido2(new Fido2Configuration { BackedUpCredentialPolicy = Fido2Configuration.CredentialBackupPolicy.Disallowed, - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -2440,8 +2440,8 @@ public async Task TestAuthenticatorAssertionStoredPublicKeyMissing() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -2516,8 +2516,8 @@ public async Task TestAuthenticatorAssertionInvalidSignature() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp } }); @@ -2599,8 +2599,8 @@ public async Task TestAuthenticatorAssertionSignCountSignature() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); diff --git a/Tests/Fido2.Tests/Fido2Tests.cs b/Tests/Fido2.Tests/Fido2Tests.cs index e9b9b250..bf2ae811 100644 --- a/Tests/Fido2.Tests/Fido2Tests.cs +++ b/Tests/Fido2.Tests/Fido2Tests.cs @@ -234,8 +234,8 @@ public async Task MakeAttestationResponseAsync() var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); @@ -973,8 +973,8 @@ internal static async Task MakeAssertionResponseAsync( var lib = new Fido2(new Fido2Configuration { - ServerDomain = rp, - ServerName = rp, + RPID = rp, + RPName = rp, Origins = new HashSet { rp }, }); var existingCredentials = new List();