Skip to content

Commit 4f4f1c4

Browse files
authored
Demo-project: Use HTTPS and port 5001 (#611)
* Rename controllers * Move to https only and port 5001 * Remove warning * Keep tests at 44329
1 parent f83873e commit 4f4f1c4

11 files changed

+19
-18
lines changed

CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ dotnet format
6464
### Running Demo Applications
6565

6666
```bash
67-
# Run ASP.NET Core demo (requires HTTPS, expected at https://localhost:44329)
67+
# Run ASP.NET Core demo (requires HTTPS, expected at https://localhost:5001)
6868
dotnet run --project Demo/Demo.csproj
6969

7070
# Run Blazor WebAssembly demo

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Since Fido2-net-lib is part of the .NET Foundation, we ask our contributors to a
66

77
## To run the project locally
88

9-
Start Fido2Demo (preferably https, expected url https://localhost:44329) and open https://localhost:44329/ in the browser.
9+
Start Fido2Demo (preferably https, expected url https://localhost:5001) and open https://localhost:5001/ in the browser.
1010
You also need to either set the MetadataService to `null` or add the applicationSettings as described below.
1111

1212
The HTML and javascript is copied (and then updated) from WebAuthn.io.

Demo/TestController.cs renamed to Demo/ConformanceTestController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111

1212
namespace Fido2Demo;
1313

14-
public class TestController : Controller
14+
public class ConformanceTestController : Controller
1515
{
1616
/* CONFORMANCE TESTING ENDPOINTS */
1717
private static readonly DevelopmentInMemoryStore _demoStorage = new();
1818

1919
private readonly IFido2 _fido2;
2020
private readonly string _origin;
2121

22-
public TestController(IOptions<Fido2Configuration> fido2Configuration)
22+
public ConformanceTestController(IOptions<Fido2Configuration> fido2Configuration)
2323
{
2424
_origin = fido2Configuration.Value.FullyQualifiedOrigins.FirstOrDefault();
2525

Demo/Controller.cs renamed to Demo/DemoController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
namespace Fido2Demo;
1010

1111
[Route("api/[controller]")]
12-
public class MyController : Controller
12+
public class DemoController : Controller
1313
{
1414
private IFido2 _fido2;
1515
public static IMetadataService _mds;
1616
public static readonly DevelopmentInMemoryStore DemoStorage = new();
1717

18-
public MyController(IFido2 fido2)
18+
public DemoController(IFido2 fido2)
1919
{
2020
_fido2 = fido2;
2121
}

Demo/Pages/dashboard.cshtml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
Layout = "_Layout.cshtml";
66

77
// Please know that this is not good for production:
8-
var DemoStorage = MyController.DemoStorage;
9-
var _mds = MyController._mds;
8+
var DemoStorage = DemoController.DemoStorage;
9+
var _mds = DemoController._mds;
1010

1111
var username = Model.Username;
1212

Demo/Pages/usernameless.cshtml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@
1515
Please note: Your browser does not seem to support WebAuthn yet. <a href="https://caniuse.com/#search=webauthn" target="_blank">Supported browsers</a>
1616
</div>
1717

18-
<div class="notification is-warning">
19-
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)
20-
</div>
2118
<div class="columns">
2219
<div class="column is-4">
2320

Demo/Properties/launchSettings.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"windowsAuthentication": false,
44
"anonymousAuthentication": true,
55
"iisExpress": {
6-
"applicationUrl": "http://localhost:4728/",
7-
"sslPort": 44329
6+
"applicationUrl": "https://localhost:5001/",
7+
"sslPort": 5001
88
}
99
},
1010
"profiles": {
@@ -20,7 +20,7 @@
2020
"environmentVariables": {
2121
"ASPNETCORE_ENVIRONMENT": "Development"
2222
},
23-
"applicationUrl": "http://localhost:4729/;https://localhost:44329/"
23+
"applicationUrl": "https://localhost:5001/"
2424
}
2525
}
2626
}

Demo/Startup.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
7070
app.UseRewriter(new RewriteOptions().AddRedirectToWWwIfPasswordlessDomain());
7171
}
7272

73+
// Enforce HTTPS redirection for all requests
74+
app.UseHttpsRedirection();
75+
7376
app.UseSession();
7477
app.UseStaticFiles();
7578
app.UseRouting();

Demo/appsettings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"fido2": {
33
"serverDomain": "localhost",
4-
"origins": [ "https://localhost:44329" ],
4+
"origins": [ "https://localhost:5001" ],
55
"timestampDriftTolerance": 300000,
66
"backupEligibleCredentialPolicy": "allowed",
77
"backedUpCredentialPolicy": "allowed"

Demo/launchSettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
"windowsAuthentication": false,
44
"anonymousAuthentication": true,
55
"iisExpress": {
6-
"applicationUrl": "https://localhost:44329/",
7-
"sslPort": 44329
6+
"applicationUrl": "https://localhost:5001/",
7+
"sslPort": 5001
88
}
99
}
1010
}

0 commit comments

Comments
 (0)