36 lines
1.1 KiB
C#
36 lines
1.1 KiB
C#
using Serilog;
|
|
using System.Threading.Tasks;
|
|
using TemenosSecurity;
|
|
|
|
namespace LCU.API.Collections.CollectionsApi.Dao
|
|
{
|
|
public class TemenosSessionDao : ITemenosSessionDao
|
|
{
|
|
private readonly ISecurity _securityService;
|
|
private readonly ITemenosSecurityConfig _securityConfig;
|
|
|
|
public TemenosSessionDao(ISecurity securityService, ITemenosSecurityConfig securityConfig)
|
|
{
|
|
_securityService = securityService;
|
|
_securityConfig = securityConfig;
|
|
}
|
|
|
|
public async Task<GetSessionResponse> GetSession()
|
|
{
|
|
var sessionRequest = new GetSessionRequest()
|
|
{
|
|
UserName = _securityConfig.GetUsername(),
|
|
Password = _securityConfig.GetPassword()
|
|
};
|
|
|
|
var response = await _securityService.GetSessionAsync(sessionRequest);
|
|
if (response != null && response.Result)
|
|
{
|
|
return response;
|
|
}
|
|
|
|
Log.Error($"Error getting Getting Temenos Session");
|
|
return null;
|
|
}
|
|
}
|
|
} |