Add cookie/JWT-based authentication and user context headers

Introduce a new authentication mechanism using JWT tokens stored in cookies, with a custom CookieAuthHandler for API request authentication. Add AuthServiceSettings for configuration and UserHeaderHandler to propagate user context in outgoing HTTP requests. Update service registrations and configuration files to support the new authentication flow. Refactor CurrentUserService for simplicity. This enables stateless, cookie-based authentication and consistent user context across API calls.
This commit is contained in:
OlgunR
2026-05-13 13:46:45 +02:00
parent de5d1b666c
commit ed3e7d4043
8 changed files with 224 additions and 42 deletions

View File

@@ -2,7 +2,31 @@
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft.AspNetCore": "Warning"
"Microsoft.AspNetCore": "Warning",
"DbFirst.API.Services.CookieAuthHandler": "Debug"
}
}
}
},
"AuthService": {
"BaseUrl": "http://172.24.12.39:9090/",
"Login": "api/Auth/db-first/login",
"Logout": "api/Auth/logout",
"Check": "api/Auth/check"
},
"ConnectionStrings": {
"DefaultConnection": "Server=SDD-VMP04-SQL17\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;TrustServerCertificate=True;",
"MassDataConnection": "Server=SDD-VMP04-SQL19\\DD_DEVELOP01;Database=DD_ECM;User Id=sa;Password=dd;TrustServerCertificate=True;"
},
"Cors": {
"AllowedOrigins": [
"https://localhost:7276",
"http://localhost:5101"
]
},
"Dashboard": {
"BaseUrl": "https://localhost:7204"
},
"BrowserLink": {
"Enabled": false
},
"DetailedErrors": true
}