admin user

This commit is contained in:
Tizian.Breuch
2025-07-25 11:22:13 +02:00
parent a51be188d9
commit 407a3d731b
5 changed files with 88 additions and 18 deletions

View File

@@ -15,9 +15,9 @@ namespace Webshop.Api.Controllers.Admin
[Authorize(Roles = "Admin")]
public class AdminUsersController : ControllerBase
{
private readonly AdminUserService _adminUserService;
private readonly IAdminUserService _adminUserService;
public AdminUsersController(AdminUserService adminUserService)
public AdminUsersController(IAdminUserService adminUserService)
{
_adminUserService = adminUserService;
}

View File

@@ -13,6 +13,7 @@ using Microsoft.AspNetCore.HttpOverrides; // For UseForwardedHeaders
using Microsoft.Extensions.Logging; // For ILogger
using Microsoft.OpenApi.Models; // For Swagger OpenAPI models
using Webshop.Api.SwaggerFilters; // For AuthorizeOperationFilter
using Webshop.Domain.Entities;
var builder = WebApplication.CreateBuilder(args);
@@ -24,9 +25,12 @@ builder.Services.AddDbContext<ApplicationDbContext>(options =>
);
// 2. ASP.NET Core Identity f<>r Benutzerverwaltung registrieren
builder.Services.AddIdentity<IdentityUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddDefaultTokenProviders();
builder.Services.AddIdentity<ApplicationUser, IdentityRole>(options =>
{
options.SignIn.RequireConfirmedAccount = true;
})
.AddEntityFrameworkStores<ApplicationDbContext>() // Stellen Sie sicher, dass Ihr DbContext-Name hier korrekt ist
.AddDefaultTokenProviders();
// Optional: Passe die Anforderungen f<>r Passw<73>rter f<>r die Entwicklung an
builder.Services.Configure<IdentityOptions>(options =>