Anmeldung
+ +@if (error is not null) +{ +@error
+}
+
+
+
+
+
+
+
+
+
+
+
+
+Benutzerübersicht
@@ -147,6 +149,15 @@ else protected override async Task OnInitializedAsync() { + var isLoggedIn = await AuthService.IsLoggedInAsync(); + if (!isLoggedIn) + { + Nav.NavigateTo("/login", forceLoad: true); + return; + } + + + var result = await UserService.GetUsersAsync(); if (!result.Success) diff --git a/OnProfNext.Client/Program.cs b/OnProfNext.Client/Program.cs index 5378689..6e81e0c 100644 --- a/OnProfNext.Client/Program.cs +++ b/OnProfNext.Client/Program.cs @@ -2,18 +2,47 @@ using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using OnProfNext.Client; using OnProfNext.Client.Services; -using Microsoft.Extensions.Http; -using System.Net.Http; var builder = WebAssemblyHostBuilder.CreateDefault(args); builder.RootComponents.Add
-
-
+
+
diff --git a/OnProfNext.Server/Controllers/AuthController.cs b/OnProfNext.Server/Controllers/AuthController.cs
new file mode 100644
index 0000000..5c17652
--- /dev/null
+++ b/OnProfNext.Server/Controllers/AuthController.cs
@@ -0,0 +1,73 @@
+using Microsoft.AspNetCore.Authorization;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.IdentityModel.Tokens;
+using OnProfNext.Server.Data;
+using OnProfNext.Shared.Models;
+using System.IdentityModel.Tokens.Jwt;
+using System.Security.Claims;
+using System.Text;
+
+namespace OnProfNext.Server.Controllers
+{
+ [ApiController]
+ [Route("api/[controller]")]
+
+ public class AuthController : ControllerBase
+ {
+ private readonly AppDbContext _context;
+ private readonly IConfiguration _configuration;
+
+ public AuthController(AppDbContext context, IConfiguration configuration)
+ {
+ _context = context;
+ _configuration = configuration;
+ }
+
+ [AllowAnonymous]
+ [HttpPost("login")]
+ public async Task
+
+
OnProf Next lädt...
+