Reogranised API and Security assets

This commit is contained in:
2026-08-30 15:08:58 +02:00
parent c204cbb1c2
commit 4827cb5795
57 changed files with 88 additions and 89 deletions
@@ -1,7 +1,6 @@
using PostFundManagement.Domain.Abstractions;
using PostFundManagement.Domain.Api.Configuration;
using PostFundManagement.Domain.Api.Models;
using PostFundManagement.Domain.Sdk;
using PostFundManagement.Domain.Security.Configuration;
using PostFundManagement.Domain.Security.Models;
using PostFundManagement.Domain.Security.Sdk;
namespace PostFundManagement.Application.Services.Shared;
@@ -9,11 +8,11 @@ public sealed class TokenService(ISecurityConnectApi connectApi, IOptions<Securi
{
private readonly SecurityClientSettings clientSettings = clientOptions.Value;
public async Task<Result<Domain.Api.Models.TokenResponse>> GenerateAsync(CancellationToken cancellationToken = default)
public async Task<Result<Domain.Security.Models.TokenResponse>> GenerateAsync(CancellationToken cancellationToken = default)
{
try
{
var request = new Domain.Api.Models.TokenRequest
var request = new Domain.Security.Models.TokenRequest
{
ClientId = clientSettings.ClientId,
ClientSecret = clientSettings.ClientSecret,
@@ -30,11 +29,11 @@ public sealed class TokenService(ISecurityConnectApi connectApi, IOptions<Securi
if (response.IsSuccessStatusCode)
{
var tokenResponse = JsonSerializer.Deserialize<Domain.Api.Models.TokenResponse>(contentRaw);
var tokenResponse = JsonSerializer.Deserialize<Domain.Security.Models.TokenResponse>(contentRaw);
return !string.IsNullOrWhiteSpace(tokenResponse?.AccessToken)
? Result.Ok(tokenResponse)
: Result.Fail<Domain.Api.Models.TokenResponse>(new Error("Authentication succeeded, but no access token was found in the response payload."));
: Result.Fail<Domain.Security.Models.TokenResponse>(new Error("Authentication succeeded, but no access token was found in the response payload."));
}
try