in src/Covi/Features/MedicalLogin/Services/MedicalAuthenticationService.cs [50:78]
public async Task<bool> MedicalAuthenticateAsync(string healthSecurityId)
{
var isMedicalAuthenticated = false;
try
{
_connectivityService.CheckConnection();
var profileResponse = await _client.Endpoints
.RegisterMedicalAsync(new RegisterDoctorRequest(healthSecurityId)).ConfigureAwait(false);
if (profileResponse != null)
{
var newAccount = new Account.Models.AccountInformation(profileResponse.UserProfile.Roles);
await _accountContainer.SetAsync(newAccount);
isMedicalAuthenticated = true;
}
}
catch (Exception ex)
{
_logger.LogError(ex, "Failed to authenticate as medical user.");
if (_serviceErrorHandler.TryHandle(ex, out var generatedException))
{
generatedException.Rethrow();
}
throw;
}
return isMedicalAuthenticated;
}