Procházet zdrojové kódy

WIP: credential options

Lukas Angerer před 2 roky
rodič
revize
9489ae5648
4 změnil soubory, kde provedl 21 přidání a 19 odebrání
  1. 17 19
      Program.cs
  2. 4 0
      data/test.json
  3. 0 0
      requests/buildCredentialOptions.http
  4. 0 0
      wwwroot/main.js

+ 17 - 19
Program.cs

@@ -1,9 +1,18 @@
+using Fido2NetLib;
+
 var builder = WebApplication.CreateBuilder(args);
 
 // Add services to the container.
 // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
 builder.Services.AddEndpointsApiExplorer();
 builder.Services.AddSwaggerGen();
+builder.Services.AddFido2(options =>
+{
+    options.ServerDomain = "localhost";
+    options.ServerName = "FIDO2 Test";
+    options.Origins = ["http://localhost:5172"];
+    options.TimestampDriftTolerance = 300000;
+});
 
 var app = builder.Build();
 
@@ -22,24 +31,13 @@ var summaries = new[]
     "Freezing", "Bracing", "Chilly", "Cool", "Mild", "Warm", "Balmy", "Hot", "Sweltering", "Scorching"
 };
 
-app.MapGet("/weatherforecast", () =>
-{
-    var forecast =  Enumerable.Range(1, 5).Select(index =>
-        new WeatherForecast
-        (
-            DateOnly.FromDateTime(DateTime.Now.AddDays(index)),
-            Random.Shared.Next(-20, 55),
-            summaries[Random.Shared.Next(summaries.Length)]
-        ))
-        .ToArray();
-    return forecast;
-})
-.WithName("GetWeatherForecast")
-.WithOpenApi();
 
-app.Run();
+app.MapGet("/buildCredentialOptions", (IFido2 fido2) =>
+    {
+        var data = File.ReadAllText("./data/test.json");
+        return data;
+    })
+    .WithName("BuildCredentialOptions")
+    .WithOpenApi();
 
-record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary)
-{
-    public int TemperatureF => 32 + (int)(TemperatureC / 0.5556);
-}
+app.Run();

+ 4 - 0
data/test.json

@@ -0,0 +1,4 @@
+{
+  "Hello": "World",
+  "Value": 42
+}

+ 0 - 0
requests/buildCredentialOptions.http


+ 0 - 0
wwwroot/main.js