using Fido2NetLib; using Microsoft.AspNetCore.Mvc; using Passwordless; 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; }); builder.Services.AddMemoryCache(); builder.Services.AddTransient(); builder.Services.AddTransient(); var app = builder.Build(); // Configure the HTTP request pipeline. if (app.Environment.IsDevelopment()) { app.UseSwagger(); app.UseSwaggerUI(); } app.UseStaticFiles(); app.UseHttpsRedirection(); app.MapGet("/buildCredentialOptions", ([FromQuery] string login, CredentialManager credMan) => credMan.BuildCredentialOptions(login)) .WithName("BuildCredentialOptions") .WithOpenApi(); app.MapPost("/registerCredential", async ([FromQuery] string login, [FromBody] AuthenticatorAttestationRawResponse attestationResponse, CredentialManager credMan) => await credMan.RegisterCredential(login, attestationResponse)) .WithName("RegisterCredential") .WithOpenApi(); app.Run();