How nailrasulov/loginregisterapi works
LoReg is an ASP.NET API for user identity and role administration, with registration, login, token refresh/logout, and authenticated profile lookup as its principal workflow. Admins can also create doctor and admin accounts. The API dispatches requests to MediatR handlers; handlers use identity, token-generation, and refresh-token abstractions, implemented in the infrastructure layer. The source excerpts establish several calls directly, but not the logout handler, token-generation helper internals, or dependency-injection bindings, so those links are not inferred.
Main entry points: AuthController.cs Auth controller · IIdentityService.cs Identity contract · RefreshTokenCommandHandler.cs Refresh handler · LoginUserCommandHandler.cs Login handler
Components 22
API entry
- Auth controller
LoReg/LoReg.API/Controllers/AuthController.cs - Admin controller
LoReg/LoReg.API/Controllers/AdminController.cs
Application workflows
- Register handler
LoReg/LoReg.Application/Features/Auth/Register/RegisterUserCommandHandler.cs - Login handler
LoReg/LoReg.Application/Features/Auth/Login/LoginUserCommandHandler.cs - Refresh handler
LoReg/LoReg.Application/Features/Auth/Refresh/RefreshTokenCommandHandler.cs - Logout handler
LoReg/LoReg.Application/Features/Auth/Logout/LogoutCommandHandler.cs - Profile handler
LoReg/LoReg.Application/Features/Auth/Me/GetMeQueryHandler.cs - Create doctor handler
LoReg/LoReg.Application/Features/Admin/CreateDoctor/CreateDoctorCommandHandler.cs - Create admin handler
LoReg/LoReg.Application/Features/Admin/CreateAdmin/CreateAdminCommandHandler.cs
Identity services
- Identity contract
LoReg/LoReg.Application/Interfaces/IIdentityService.cs - Identity service
LoReg/LoReg.Infrastructure/Identity/IdentityService.cs - Application user
LoReg/LoReg.Infrastructure/Identity/AppUser.cs - Token response helper
LoReg/LoReg.Application/Features/Auth/Common/TokenGenerationHelper.cs - Token service contract
LoReg/LoReg.Application/Interfaces/ITokenService.cs - JWT token service
LoReg/LoReg.Infrastructure/Security/JwtTokenService.cs
Persistence and tokens
- Refresh token
LoReg/LoReg.Domain/Entities/RefreshToken.cs - Refresh token contract
LoReg/LoReg.Domain/Repositories/Interfaces/IRefreshTokenRepository.cs - Refresh repository
LoReg/LoReg.Infrastructure/Persistence/RefreshTokenRepository.cs - Application database
LoReg/LoReg.Infrastructure/Persistence/AppDbContext.cs
Other components
- API client
- Auth response
LoReg/LoReg.Application/DTO's/AuthResponseDto.cs - User response
LoReg/LoReg.Application/DTO's/UserResponseDto.cs
Connections 31
- API client → Auth controller: sends auth requests
- API client → Admin controller: sends admin requests
- Auth controller → Register handler: dispatches registration
- Auth controller → Login handler: dispatches login
- Auth controller → Refresh handler: dispatches refresh
- Auth controller → Logout handler: dispatches logout
- Auth controller → Profile handler: dispatches profile query
- Admin controller → Create doctor handler: dispatches doctor creation
- Admin controller → Create admin handler: dispatches admin creation
- Register handler → Identity contract: creates and finds user
- Login handler → Identity contract: checks and finds user
- Profile handler → Identity contract: finds user
- Create doctor handler → Identity contract: creates and finds user
- Create admin handler → Identity contract: creates and finds user
- Refresh handler → Identity contract: finds user
- Identity service → Identity contract: implements
- Identity service → Application user: uses user records
- Login handler → Token response helper: generates auth response
- Refresh handler → Token response helper: generates auth response
- Token response helper → Token service contract: uses token service
- JWT token service → Token service contract: implements
- Refresh handler → Refresh token contract: reads and revokes tokens
- Refresh repository → Refresh token contract: implements
- Refresh repository → Application database: reads and writes tokens
- Refresh repository → Refresh token: stores token records
- Login handler → Auth response: returns
- Refresh handler → Auth response: returns
- Register handler → User response: returns
- Profile handler → User response: returns
- Create doctor handler → User response: returns
- Create admin handler → User response: returns