added basic functionalities (login, create/del/rename pages)
This commit is contained in:
@@ -1,13 +1,36 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Authentication.Cookies;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Server;
|
||||
using Tagger.Service;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
|
||||
builder.Configuration.AddJsonFile("config.json", true);
|
||||
|
||||
// Add services to the container.
|
||||
builder.Services.AddRazorPages();
|
||||
builder.Services.AddServerSideBlazor();
|
||||
builder.Services.AddHttpContextAccessor();
|
||||
builder.Services.AddSingleton<PageProvider>();
|
||||
builder.Services.AddScoped<UserManager>();
|
||||
|
||||
builder.Services.AddScoped<IHostEnvironmentAuthenticationStateProvider>(sp =>
|
||||
(ServerAuthenticationStateProvider)sp.GetRequiredService<AuthenticationStateProvider>()
|
||||
);
|
||||
|
||||
|
||||
builder.Services.AddAuthentication(CookieAuthenticationDefaults.AuthenticationScheme)
|
||||
.AddCookie(options =>
|
||||
{
|
||||
options.Cookie.Name = "auth_token";
|
||||
options.LoginPath = "/login";
|
||||
options.Cookie.MaxAge = TimeSpan.FromHours(1);
|
||||
});
|
||||
builder.Services.AddAuthorization();
|
||||
builder.Services.AddCascadingAuthenticationState();
|
||||
|
||||
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user