Skip to content

Commit 6f6684c

Browse files
authored
User more modern ASP.NET in Demo (#612)
* Clean up asp.net hosting * use main as branhc * Move to Helper folder * Use file-based using statement * Use Collection Expressions
1 parent 4f4f1c4 commit 6f6684c

14 files changed

+108
-146
lines changed

Demo/ConformanceTestController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public OkObjectResult MakeCredentialOptionsTest([FromBody] TEST_MakeCredentialPa
4040
{
4141
var attType = opts.Attestation;
4242

43-
var username = Array.Empty<byte>();
43+
byte[] username = [];
4444

4545
try
4646
{

Demo/ConformanceTesting.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ public static IMetadataService MetadataServiceInstance(string cacheDir, string o
1616
{
1717
if (_instance == null)
1818
{
19-
var repos = new List<IMetadataRepository>
20-
{
19+
List<IMetadataRepository> repos = [
2120
new ConformanceMetadataRepository(null, origin),
2221
new FileSystemMetadataRepository(cacheDir)
23-
};
22+
];
2423
var simpleService = new ConformanceMetadataService(repos);
2524
simpleService.InitializeAsync().Wait();
2625
_instance = simpleService;

Demo/DemoController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public ActionResult AssertionOptionsPost([FromForm] string username, [FromForm]
144144
{
145145
try
146146
{
147-
var existingCredentials = new List<PublicKeyCredentialDescriptor>();
147+
List<PublicKeyCredentialDescriptor> existingCredentials = [];
148148

149149
if (!string.IsNullOrEmpty(username))
150150
{
File renamed without changes.

Demo/UrlHelperExtensions.cs renamed to Demo/Helpers/UrlHelperExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ public static class UrlHelperExtensions
66
{
77
public static string ToGithub(this IUrlHelper url, string path)
88
{
9-
return "https://github.com/passwordless-lib/fido2-net-lib/blob/master/" + path;
9+
return "https://github.com/passwordless-lib/fido2-net-lib/blob/main/" + path;
1010
}
1111
}

Demo/Pages/_options.cshtml.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using Microsoft.AspNetCore.Mvc.RazorPages;
22

3-
namespace Fido2Demo.Pages
3+
namespace Fido2Demo.Pages;
4+
5+
public class _optionsModel : PageModel
46
{
5-
public class _optionsModel : PageModel
7+
public void OnGet()
68
{
7-
public void OnGet()
8-
{
9-
}
109
}
1110
}

Demo/Pages/custom.cshtml.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using Microsoft.AspNetCore.Mvc.RazorPages;
22

3-
namespace Fido2Demo
3+
namespace Fido2Demo;
4+
5+
public class CustomModel : PageModel
46
{
5-
public class CustomModel : PageModel
7+
public void OnGet()
68
{
7-
public void OnGet()
8-
{
9-
}
109
}
1110
}

Demo/Pages/dashboard.cshtml.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
using Microsoft.AspNetCore.Mvc.RazorPages;
22

3-
namespace Fido2Demo.Pages
3+
namespace Fido2Demo.Pages;
4+
5+
public class dashboardModel : PageModel
46
{
5-
public class dashboardModel : PageModel
7+
public void OnGet(string username)
68
{
7-
public void OnGet(string username)
8-
{
9-
this.Username = username;
10-
}
11-
12-
public string Username { get; set; }
9+
this.Username = username;
1310
}
11+
12+
public string Username { get; set; }
1413
}

Demo/Pages/mfa.cshtml.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
using Microsoft.AspNetCore.Mvc.RazorPages;
22

3-
namespace Fido2Demo
3+
namespace Fido2Demo;
4+
5+
public class MfaModel : PageModel
46
{
5-
public class MfaModel : PageModel
7+
public void OnGet()
68
{
7-
public void OnGet()
8-
{
9-
}
9+
}
1010

11-
public void OnPost()
12-
{
13-
}
11+
public void OnPost()
12+
{
1413
}
1514
}

Demo/Pages/overview.cshtml.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
using Microsoft.AspNetCore.Mvc.RazorPages;
22

3-
namespace Fido2Demo
3+
namespace Fido2Demo;
4+
5+
public class OverviewModel : PageModel
46
{
5-
public class OverviewModel : PageModel
7+
public void OnGet()
68
{
7-
public void OnGet()
8-
{
9-
}
109
}
1110
}

0 commit comments

Comments
 (0)