feat: offload jwt generation to guhf, move auth code to new controller

This commit is contained in:
2025-07-15 11:19:59 +02:00
parent b6dc1ce2cd
commit d0fc4e5ef2
4 changed files with 78 additions and 89 deletions

View File

@@ -1,13 +1,13 @@
using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.EntityFrameworkCore;
using Microsoft.IdentityModel.Tokens;
using QuotifyBE.Controllers;
using QuotifyBE.Data;
using QuotifyBE.Entities;
using System.Text;
var builder = WebApplication.CreateBuilder(args);
// Configure Database Conecction
// Configure Database Connection
var connectionString = builder.Configuration.GetConnectionString("DefaultConnection") ?? throw new InvalidOperationException("Connection string 'DefaultConnection' not found.");
builder.Services.AddDbContext<ApplicationDbContext>(options =>
options.UseNpgsql(connectionString));
@@ -40,6 +40,7 @@ builder.Services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
// Add services to the container.
builder.Services.AddAuthorization();
builder.Services.AddSingleton(builder.Configuration);
builder.Services.AddScoped<GeneralUseHelpers>();
builder.Services.AddControllers();
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle