diff --git a/CLAUDE.md b/CLAUDE.md index 3276c067..fd71e450 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -64,7 +64,7 @@ dotnet format ### Running Demo Applications ```bash -# Run ASP.NET Core demo (requires HTTPS, expected at https://localhost:44329) +# Run ASP.NET Core demo (requires HTTPS, expected at https://localhost:5001) dotnet run --project Demo/Demo.csproj # Run Blazor WebAssembly demo diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1193fcb4..08ae4ea5 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -6,7 +6,7 @@ Since Fido2-net-lib is part of the .NET Foundation, we ask our contributors to a ## To run the project locally -Start Fido2Demo (preferably https, expected url https://localhost:44329) and open https://localhost:44329/ in the browser. +Start Fido2Demo (preferably https, expected url https://localhost:5001) and open https://localhost:5001/ in the browser. You also need to either set the MetadataService to `null` or add the applicationSettings as described below. The HTML and javascript is copied (and then updated) from WebAuthn.io. diff --git a/Demo/TestController.cs b/Demo/ConformanceTestController.cs similarity index 96% rename from Demo/TestController.cs rename to Demo/ConformanceTestController.cs index c12a1414..b6b3b030 100644 --- a/Demo/TestController.cs +++ b/Demo/ConformanceTestController.cs @@ -11,7 +11,7 @@ namespace Fido2Demo; -public class TestController : Controller +public class ConformanceTestController : Controller { /* CONFORMANCE TESTING ENDPOINTS */ private static readonly DevelopmentInMemoryStore _demoStorage = new(); @@ -19,7 +19,7 @@ public class TestController : Controller private readonly IFido2 _fido2; private readonly string _origin; - public TestController(IOptions fido2Configuration) + public ConformanceTestController(IOptions fido2Configuration) { _origin = fido2Configuration.Value.FullyQualifiedOrigins.FirstOrDefault(); diff --git a/Demo/Controller.cs b/Demo/DemoController.cs similarity index 99% rename from Demo/Controller.cs rename to Demo/DemoController.cs index 1b745036..5c2da078 100644 --- a/Demo/Controller.cs +++ b/Demo/DemoController.cs @@ -9,13 +9,13 @@ namespace Fido2Demo; [Route("api/[controller]")] -public class MyController : Controller +public class DemoController : Controller { private IFido2 _fido2; public static IMetadataService _mds; public static readonly DevelopmentInMemoryStore DemoStorage = new(); - public MyController(IFido2 fido2) + public DemoController(IFido2 fido2) { _fido2 = fido2; } diff --git a/Demo/Pages/dashboard.cshtml b/Demo/Pages/dashboard.cshtml index 30329b0f..3b98b6bb 100644 --- a/Demo/Pages/dashboard.cshtml +++ b/Demo/Pages/dashboard.cshtml @@ -5,8 +5,8 @@ Layout = "_Layout.cshtml"; // Please know that this is not good for production: - var DemoStorage = MyController.DemoStorage; - var _mds = MyController._mds; + var DemoStorage = DemoController.DemoStorage; + var _mds = DemoController._mds; var username = Model.Username; diff --git a/Demo/Pages/usernameless.cshtml b/Demo/Pages/usernameless.cshtml index 9457cb10..83aefa11 100644 --- a/Demo/Pages/usernameless.cshtml +++ b/Demo/Pages/usernameless.cshtml @@ -15,9 +15,6 @@ Please note: Your browser does not seem to support WebAuthn yet. Supported browsers -
- Please note: At the time of writing (July 2019) this is not supported on all browsers. Confirmed to work on: Windows Edge, Edge (OS X, pre-release), Firefox 69 (Windows), Chrome 76.0.3809.72 beta (OS X) -
diff --git a/Demo/Properties/launchSettings.json b/Demo/Properties/launchSettings.json index 53d314d8..335f280d 100644 --- a/Demo/Properties/launchSettings.json +++ b/Demo/Properties/launchSettings.json @@ -3,8 +3,8 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "http://localhost:4728/", - "sslPort": 44329 + "applicationUrl": "https://localhost:5001/", + "sslPort": 5001 } }, "profiles": { @@ -20,7 +20,7 @@ "environmentVariables": { "ASPNETCORE_ENVIRONMENT": "Development" }, - "applicationUrl": "http://localhost:4729/;https://localhost:44329/" + "applicationUrl": "https://localhost:5001/" } } } diff --git a/Demo/Startup.cs b/Demo/Startup.cs index be8126f6..d5f33990 100644 --- a/Demo/Startup.cs +++ b/Demo/Startup.cs @@ -70,6 +70,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env) app.UseRewriter(new RewriteOptions().AddRedirectToWWwIfPasswordlessDomain()); } + // Enforce HTTPS redirection for all requests + app.UseHttpsRedirection(); + app.UseSession(); app.UseStaticFiles(); app.UseRouting(); diff --git a/Demo/appsettings.json b/Demo/appsettings.json index 412d460a..68e739de 100644 --- a/Demo/appsettings.json +++ b/Demo/appsettings.json @@ -1,7 +1,7 @@ { "fido2": { "serverDomain": "localhost", - "origins": [ "https://localhost:44329" ], + "origins": [ "https://localhost:5001" ], "timestampDriftTolerance": 300000, "backupEligibleCredentialPolicy": "allowed", "backedUpCredentialPolicy": "allowed" diff --git a/Demo/launchSettings.json b/Demo/launchSettings.json index fff54e1b..4920fe73 100644 --- a/Demo/launchSettings.json +++ b/Demo/launchSettings.json @@ -3,8 +3,8 @@ "windowsAuthentication": false, "anonymousAuthentication": true, "iisExpress": { - "applicationUrl": "https://localhost:44329/", - "sslPort": 44329 + "applicationUrl": "https://localhost:5001/", + "sslPort": 5001 } } } diff --git a/README.md b/README.md index 2f8a1735..b63669b4 100644 --- a/README.md +++ b/README.md @@ -121,8 +121,9 @@ public class AuthController : Controller ## Examples - **[ASP.NET Core Demo](Demo/)** - Complete implementation with registration and authentication +- **[Demo Controller](Demo/DemoController.cs)** - Main demo API endpoints for registration and authentication - **[Blazor WebAssembly Demo](BlazorWasmDemo/)** - Client-side Blazor example -- **[Test Controller](Demo/TestController.cs)** - Conformance test examples +- **[Conformance Test Controller](Demo/ConformanceTestController.cs)** - Conformance testing endpoints For integration patterns, see: