diff --git a/GWMS.User/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml b/GWMS.User/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml index 6ea8510..5506f50 100644 --- a/GWMS.User/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml +++ b/GWMS.User/Areas/Identity/Pages/Account/Manage/EnableAuthenticator.cshtml @@ -22,7 +22,7 @@
  • Scan the QR Code or enter this key @Model.SharedKey into your two factor authenticator app. Spaces and casing do not matter.

    -
    Learn how to enable QR code generation.
    + @*
    Learn how to enable QR code generation.
    *@
  • @@ -50,4 +50,14 @@ @section Scripts { -} + + + +} \ No newline at end of file diff --git a/GWMS.User/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml b/GWMS.User/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml index 9e3c008..a8bb218 100644 --- a/GWMS.User/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml +++ b/GWMS.User/Areas/Identity/Pages/Account/Manage/TwoFactorAuthentication.cshtml @@ -34,11 +34,11 @@ if (Model.IsMachineRemembered) {
    - +
    } - Disable 2FA - Reset recovery codes + Disable 2FA + Reset recovery codes }
    Authenticator app
    diff --git a/GWMS.User/GWMS.User.csproj b/GWMS.User/GWMS.User.csproj index 7743467..3cbdf25 100644 --- a/GWMS.User/GWMS.User.csproj +++ b/GWMS.User/GWMS.User.csproj @@ -33,4 +33,8 @@ + + + + \ No newline at end of file diff --git a/GWMS.User/Pages/Counter.razor b/GWMS.User/Pages/Counter.razor index c404ea4..235a1d2 100644 --- a/GWMS.User/Pages/Counter.razor +++ b/GWMS.User/Pages/Counter.razor @@ -9,6 +9,22 @@

    Current count: @currentCount

    + + + +
    +

    Hello, @context.User.Identity.Name!

    +

    This content is only visible if user is authenticated.

    +
    +
    + +
    +

    Utente anonimo

    +

    Please signed in.

    +
    +
    +
    +
    diff --git a/GWMS.User/Shared/NavMenu.razor b/GWMS.User/Shared/NavMenu.razor index 5beca2b..ff6bc94 100644 --- a/GWMS.User/Shared/NavMenu.razor +++ b/GWMS.User/Shared/NavMenu.razor @@ -17,11 +17,22 @@ Counter - + + + + + + + + @@ -34,4 +45,4 @@ { collapseNavMenu = !collapseNavMenu; } -} +} \ No newline at end of file diff --git a/GWMS.User/Startup.cs b/GWMS.User/Startup.cs index 0133cbc..9dd1873 100644 --- a/GWMS.User/Startup.cs +++ b/GWMS.User/Startup.cs @@ -1,6 +1,7 @@ using GWMS.Data; using GWMS.User.Areas.Identity; using GWMS.User.Data; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Components; using Microsoft.AspNetCore.Components.Authorization; @@ -95,6 +96,9 @@ namespace GWMS.User o.ExpireTimeSpan = TimeSpan.FromDays(30); o.SlidingExpiration = true; }); + // token di sicurezza dati a 3h + services.Configure(o => + o.TokenLifespan = TimeSpan.FromHours(3)); // DB management services.AddDbContext(options => @@ -102,9 +106,19 @@ namespace GWMS.User // identity management services.AddDefaultIdentity(options => options.SignIn.RequireConfirmedAccount = true) + .AddRoles() .AddEntityFrameworkStores(); services.AddRazorPages(); + + // richeista esplicita autorizzazione + services.AddAuthorization(options => + { + options.FallbackPolicy = new AuthorizationPolicyBuilder() + .RequireAuthenticatedUser() + .Build(); + }); + services.AddServerSideBlazor(); services.AddScoped>(); services.AddDatabaseDeveloperPageExceptionFilter();