=== Summary: 675 files | 7 generated | 484 fresh | 4605 untracked | 4268 adopted | 355 marked | 466 validated-ok | 2+0 stale (sig+body) | 0 skipped | 0 failed | elapsed 11:08:11.442 (40091.44s) ===

This commit is contained in:
julian
2026-06-28 02:50:05 -07:00
parent a19fb90902
commit 586f02a2ca
654 changed files with 5260 additions and 0 deletions
@@ -16,6 +16,7 @@ namespace adas_core.Application.Services;
/// Provides an implementation of the <see cref="IAuthService"/> interface, offering
/// authentication-related services to consuming components.
/// </summary>
/// <!-- aidoc:v1 sig=c025df9 -->
public class AuthService : IAuthService
{
private readonly IAuthorityRepository _authorityRepository;
@@ -49,6 +50,7 @@ public class AuthService : IAuthService
/// Asynchronously obtains a login token from the recording API using the configured client credentials and caches it for reuse via <see cref="AuthUtils"/>.
/// </summary>
/// <returns>A <see cref="LoginResponse"/> containing the authentication token when the request succeeds and the response is valid; otherwise, <c>null</c> if the API URL is not configured, the request fails, the returned token is empty, or an exception is caught and logged.</returns>
/// <!-- aidoc:v1 sig=6d8b512 body=bfaf63a -->
public async Task<LoginResponse?> GetLoginResponse()
{
try
@@ -100,6 +102,7 @@ public class AuthService : IAuthService
/// Otherwise, attempts a fresh login and returns the new token, falling back to an empty string when no token is obtained.
/// </summary>
/// <returns>A task that resolves to the authentication token, or an empty string if the token could not be obtained.</returns>
/// <!-- aidoc:v1 sig=2e832cc body=0ab9bf1 -->
public async Task<string> GetToken()
{
var loginResponse = AuthUtils.Instance.GetLoginResponse();
@@ -115,6 +118,7 @@ public class AuthService : IAuthService
/// </summary>
/// <param name="unitId">The unique identifier of the unit whose authorizations are being retrieved.</param>
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Authorization"/> objects for the specified unit.</returns>
/// <!-- aidoc:v1 sig=37cf403 body=9b4aba2 -->
public async Task<List<Authorization>> GetByUnitId(ObjectId unitId)
{
return await _authorityRepository.GetByUnitId(unitId);
@@ -125,6 +129,7 @@ public class AuthService : IAuthService
/// </summary>
/// <param name="id">The unique identifier of the user whose authorities are being requested.</param>
/// <returns>A task that represents the asynchronous operation, containing a list of <see cref="Authorization"/> entries for the user.</returns>
/// <!-- aidoc:v1 sig=7b40daa body=48ea4d9 -->
public async Task<List<Authorization>> GetUserAuthorities(ObjectId id)
{
return await _authorityRepository.GetUserAuthorities(id);
@@ -135,6 +140,7 @@ public class AuthService : IAuthService
/// </summary>
/// <param name="unitId">The identifier of the unit whose authorities are to be removed.</param>
/// <returns>A task that represents the asynchronous operation. The task result is <c>true</c> if the deletion was successful; otherwise, <c>false</c>.</returns>
/// <!-- aidoc:v1 sig=d4333b3 body=ae8ffe1 -->
public async Task<bool> DeleteByUnitId(ObjectId unitId)
{
return await _authorityRepository.DeleteAllAuthoritiesByUnit(unitId);
@@ -145,6 +151,7 @@ public class AuthService : IAuthService
/// </summary>
/// <param name="displayId">The unique identifier of the display whose related authorities should be removed.</param>
/// <returns>A task that resolves to <c>true</c> if authorities were successfully deleted; otherwise, <c>false</c>.</returns>
/// <!-- aidoc:v1 sig=87a9f41 body=fa867f0 -->
public async Task<bool> DeleteByDisplayId(ObjectId displayId)
{
return await _authorityRepository.DeleteAllAuthoritiesByDisplay(displayId);
@@ -153,6 +160,7 @@ public class AuthService : IAuthService
/// <summary>
/// Ensures the authentication utilities are initialized with a valid login token. Returns early if the recording API URL is not configured; otherwise, requests a new token when the current one is missing or expired, and updates the shared <see cref="AuthUtils"/> instance with the refreshed response when successful.
/// </summary>
/// <!-- aidoc:v1 sig=e577d60 body=e927320 -->
private async Task InstanceAuthUtils()
{
if (_recordingSettings.RecordingApiUrl.IsEmpty())