From 3063d3bdefebcbba56c5b98c87d272ab91dc7671 Mon Sep 17 00:00:00 2001 From: "zaccaria.majid" Date: Fri, 28 Jul 2023 08:22:22 +0200 Subject: [PATCH] aggiunta autenticazione windows --- SMGen.Data/SMGen.Data.csproj | 1 + SMGen/Program.cs | 12 ++++++++++++ SMGen/SMGen.csproj | 1 + 3 files changed, 14 insertions(+) diff --git a/SMGen.Data/SMGen.Data.csproj b/SMGen.Data/SMGen.Data.csproj index 7a23086..58f832e 100644 --- a/SMGen.Data/SMGen.Data.csproj +++ b/SMGen.Data/SMGen.Data.csproj @@ -13,6 +13,7 @@ + diff --git a/SMGen/Program.cs b/SMGen/Program.cs index 5f7fa07..8b3d61d 100644 --- a/SMGen/Program.cs +++ b/SMGen/Program.cs @@ -5,9 +5,18 @@ using Microsoft.EntityFrameworkCore; using SMGen.Data; using SMGen.Data.Controllers; using SMGen.Data.Services; +using Microsoft.AspNetCore.Authentication.Negotiate; var builder = WebApplication.CreateBuilder(args); +// Add services to the container. +builder.Services.AddAuthentication(NegotiateDefaults.AuthenticationScheme) + .AddNegotiate(); +builder.Services.AddAuthorization(options => +{ + // By default, all incoming requests will be authorized according to the default policy. + options.FallbackPolicy = options.DefaultPolicy; +}); // Add services to the container. builder.Services.AddRazorPages(); builder.Services.AddServerSideBlazor(); @@ -28,6 +37,9 @@ app.UseStaticFiles(); app.UseRouting(); +app.UseAuthentication(); +app.UseAuthorization(); + app.MapBlazorHub(); app.MapFallbackToPage("/_Host"); diff --git a/SMGen/SMGen.csproj b/SMGen/SMGen.csproj index ac861ca..9d6262f 100644 --- a/SMGen/SMGen.csproj +++ b/SMGen/SMGen.csproj @@ -26,6 +26,7 @@ +