mirror of
https://github.com/azaion/admin.git
synced 2026-06-21 08:11:08 +00:00
3a925b9b0f
- Deleted the `POST /resources/get/{dataFolder?}` and `GET /resources/get-installer` endpoints as part of the architectural shift towards simplified resource management.
- Removed associated methods and configurations, including `ResourcesService.GetEncryptedResource`, `ResourcesService.GetInstaller`, and related properties in `ResourcesConfig`.
- Cleaned up environment variables and configuration files to reflect the removal of installer-related settings.
- Eliminated the `GetResourceRequest` DTO and its validator, along with the `WrongResourceName` error code.
- Updated documentation to clarify the changes in resource handling and the retirement of per-user file encryption.
Co-authored-by: Cursor <cursoragent@cursor.com>
1.9 KiB
1.9 KiB
Module: Azaion.Services.AuthService
Purpose
JWT token creation and current-user resolution from HTTP context claims.
Public Interface
IAuthService
| Method | Signature | Description |
|---|---|---|
GetCurrentUser |
Task<User?> GetCurrentUser() |
Extracts email from JWT claims, returns full User entity |
CreateToken |
string CreateToken(User user) |
Generates a signed JWT token for the given user |
Internal Logic
- GetCurrentUser: reads
ClaimTypes.NamefromHttpContext.User.Claims, then delegates toIUserService.GetByEmail. - CreateToken: builds a
SecurityTokenDescriptorwith claims (NameIdentifier = user ID, Name = email, Role = role), signs with HMAC-SHA256 using the configured secret, sets expiry fromJwtConfig.TokenLifetimeHours.
Private method:
GetCurrentUserEmail— extracts email from claims dictionary.
Dependencies
IHttpContextAccessor— for accessing current HTTP contextIOptions<JwtConfig>— JWT configurationIUserService— forGetByEmaillookupSystem.IdentityModel.Tokens.JwtMicrosoft.IdentityModel.Tokens
Consumers
Program.cs/loginendpoint — callsCreateTokenafter successful validationProgram.cs/users/current— callsGetCurrentUser(the previously listed/resources/get,/resources/get-installer,/resources/checkconsumers were removed in cycle 2 / by AZ-197 along with their endpoints)
Data Models
None.
Configuration
Uses JwtConfig (Issuer, Audience, Secret, TokenLifetimeHours).
External Integrations
None.
Security
- Token includes user ID, email, and role as claims
- Signed with HMAC-SHA256
- Expiry controlled by
TokenLifetimeHoursconfig - Token validation parameters are configured in
Program.cs(ValidateIssuer, ValidateAudience, ValidateLifetime, ValidateIssuerSigningKey)
Tests
None.