Преглед на файлове

Screening test fixed some bugs

feature/removed_using_of_env_variable
Safet Purkovic преди 2 години
родител
ревизия
8cb3d755bf
променени са 2 файла, в които са добавени 5 реда и са изтрити 5 реда
  1. 3
    3
      Diligent.WebAPI.Business/Services/ScreeningTestService.cs
  2. 2
    2
      Diligent.WebAPI.Host/appsettings.json

+ 3
- 3
Diligent.WebAPI.Business/Services/ScreeningTestService.cs Целия файл

@@ -75,7 +75,7 @@ namespace Diligent.WebAPI.Business.Services
private async Task<string> GetToken()
{
string token = "";
if (_memoryCache.TryGetValue("JWT", out string t))
if (_memoryCache.TryGetValue("JWT", out string t) && !string.IsNullOrEmpty(t))
{
token = t;
}
@@ -96,7 +96,7 @@ namespace Diligent.WebAPI.Business.Services

public async Task<AuthSuccessResponse> LoginToScreening()
{
_logger.LogInformation($"Start calling microservice to login");
_logger.LogInformation($"Start calling microservice to login on service {string.Format(_settings.Url + "auth")}");
var httpClient = new HttpClient();
var requestUri = new Uri(string.Format(_settings.Url + "auth"));
var httpContent = new StringContent(System.Text.Json.JsonSerializer.Serialize(new AuthMicroserviceRequest
@@ -111,7 +111,7 @@ namespace Diligent.WebAPI.Business.Services
try
{
var result = JsonConvert.DeserializeObject<AuthSuccessResponse>(content);
var expires = result.Expires.Value - DateTime.Now;
var expires = result.Expires.Value - DateTime.UtcNow;
var cacheEntryOptions = new MemoryCacheEntryOptions()
.SetSlidingExpiration(TimeSpan.FromSeconds(60))
.SetAbsoluteExpiration(expires)

+ 2
- 2
Diligent.WebAPI.Host/appsettings.json Целия файл

@@ -51,9 +51,9 @@
"BaseUrl": "https://test-hr-center.dilig.net"
},
"ScreeningTest": {
"Url": "https://localhost:44349/api/v1/",
"Url": "https://test-integration-api.dilig.net/api/v1/",
"Email": "hrcenter@dilig.net",
"Password": "MYRandomPass135!",
"link": "https://localhost:44336/Intern/ToS?id={0}"
"link": "https://testing.dilig.net/Intern/ToS?id={0}"
}
}

Loading…
Отказ
Запис