- Enable UseAuthentication middleware.

- Fix variable typo from `postgreConnection` to `postgresConnection`.
- Update `.gitignore` to exclude SQLite database files.
This commit is contained in:
2026-01-23 21:52:20 +01:00
parent 534ec5f36f
commit e0ecdad408
3 changed files with 12 additions and 6 deletions

7
.gitignore vendored
View File

@@ -85,4 +85,9 @@ API/app.db-shm
# Vite build output
GUI/dist/
wwwroot/
wwwroot/
# SQLite Datenbank-Dateien
*.db
*.db-shm
*.db-wal

View File

@@ -18,18 +18,19 @@ builder.Services.AddSwaggerGen();
// Authentication
builder.Services.AddAuthorization();
builder.Services.AddAuthentication().AddCookie(IdentityConstants.ApplicationScheme);
builder.Services.AddAuthentication()
.AddCookie(IdentityConstants.ApplicationScheme);
builder.Services.AddIdentityCore<User>()
.AddEntityFrameworkStores<ApplicationDbContext>()
.AddApiEndpoints();
// Database
var postgreConnection = builder.Configuration.GetConnectionString("PostgresConnection");
if (!string.IsNullOrEmpty(postgreConnection))
var postgresConnection = builder.Configuration.GetConnectionString("PostgresConnection");
if (!string.IsNullOrEmpty(postgresConnection))
{
// Nutze PostgresSQL
builder.Services.AddDbContext<ApplicationDbContext>(options => options.UseNpgsql(postgreConnection));
builder.Services.AddDbContext<ApplicationDbContext>(options => options.UseNpgsql(postgresConnection));
}
else
{
@@ -64,7 +65,7 @@ app.UseDefaultFiles();
app.UseStaticFiles();
app.UseHttpsRedirection();
app.UseAuthentication();
app.UseAuthorization();
// Map Auth Endpoints

Binary file not shown.