refactor(thalos-bff): use identity contracts

This commit is contained in:
José René White Enciso 2026-02-24 05:26:54 -06:00
parent 3997d5d77e
commit 26c6e141c0
16 changed files with 50 additions and 33 deletions

View File

@ -0,0 +1,14 @@
# Thalos BFF Identity Boundary
## Purpose
Keep thalos-bff as an edge adapter layer that consumes thalos-service and adopted identity capability contracts.
## BFF Responsibilities
- Edge contract handling
- Service client adaptation
- Correlation/tracing propagation
## Prohibited
- Direct DAL access
- Identity policy decision ownership
- Identity persistence concerns

View File

@ -0,0 +1,13 @@
# Building Block Identity Adoption Plan
## Goal
Align BFF contract usage with building-block-identity contract surface without changing behavior.
## Steps
1. Map current BFF identity contract types to capability contract types.
2. Keep compatibility bridge active during migration window.
3. Validate edge payload behavior and service compatibility.
## Guardrails
- BFF remains service-facing.
- No identity decision logic moves into BFF.

View File

@ -0,0 +1,6 @@
# Edge Compatibility Checks
## Checks
- Existing edge request/response behavior remains stable.
- Correlation and trace metadata pass-through remains stable.
- Service contract compatibility is preserved after identity contract adoption.

View File

@ -1,6 +1,6 @@
using Thalos.Bff.Application.Contracts;
using Thalos.Bff.Contracts.Api; using Thalos.Bff.Contracts.Api;
using Thalos.Service.Identity.Abstractions.Contracts; using BuildingBlock.Identity.Contracts.Requests;
using BuildingBlock.Identity.Contracts.Responses;
namespace Thalos.Bff.Application.Adapters; namespace Thalos.Bff.Application.Adapters;

View File

@ -1,5 +1,5 @@
using Thalos.Bff.Application.Contracts; using BuildingBlock.Identity.Contracts.Requests;
using Thalos.Service.Identity.Abstractions.Contracts; using BuildingBlock.Identity.Contracts.Responses;
namespace Thalos.Bff.Application.Adapters; namespace Thalos.Bff.Application.Adapters;

View File

@ -1,6 +1,6 @@
using Thalos.Bff.Application.Contracts;
using Thalos.Bff.Contracts.Api; using Thalos.Bff.Contracts.Api;
using Thalos.Service.Identity.Abstractions.Contracts; using BuildingBlock.Identity.Contracts.Requests;
using BuildingBlock.Identity.Contracts.Responses;
namespace Thalos.Bff.Application.Adapters; namespace Thalos.Bff.Application.Adapters;

View File

@ -1,8 +0,0 @@
namespace Thalos.Bff.Application.Contracts;
/// <summary>
/// Transport-neutral internal request contract for refresh session flow.
/// </summary>
/// <param name="RefreshToken">Refresh token value.</param>
/// <param name="CorrelationId">Request correlation identifier.</param>
public sealed record RefreshIdentitySessionRequest(string RefreshToken, string CorrelationId);

View File

@ -1,8 +0,0 @@
namespace Thalos.Bff.Application.Contracts;
/// <summary>
/// Transport-neutral internal response contract for refresh session flow.
/// </summary>
/// <param name="Token">Refreshed token value.</param>
/// <param name="ExpiresInSeconds">Token expiration in seconds.</param>
public sealed record RefreshIdentitySessionResponse(string Token, int ExpiresInSeconds);

View File

@ -1,4 +1,4 @@
using Thalos.Service.Identity.Abstractions.Contracts; using BuildingBlock.Identity.Contracts.Responses;
namespace Thalos.Bff.Application.Security; namespace Thalos.Bff.Application.Security;

View File

@ -1,4 +1,4 @@
using Thalos.Service.Identity.Abstractions.Contracts; using BuildingBlock.Identity.Contracts.Responses;
namespace Thalos.Bff.Application.Security; namespace Thalos.Bff.Application.Security;

View File

@ -7,6 +7,6 @@
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" /> <PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="10.0.0" />
<ProjectReference Include="..\Thalos.Bff.Contracts\Thalos.Bff.Contracts.csproj" /> <ProjectReference Include="..\Thalos.Bff.Contracts\Thalos.Bff.Contracts.csproj" />
<ProjectReference Include="..\..\..\thalos-service\src\Thalos.Service.Identity.Abstractions\Thalos.Service.Identity.Abstractions.csproj" /> <ProjectReference Include="..\..\..\building-block-identity\src\BuildingBlock.Identity.Contracts\BuildingBlock.Identity.Contracts.csproj" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -11,5 +11,5 @@ public sealed class ThalosBffPackageContract : IBlueprintPackageContract
public BlueprintPackageDescriptor Descriptor { get; } = new( public BlueprintPackageDescriptor Descriptor { get; } = new(
"Thalos.Bff.Contracts", "Thalos.Bff.Contracts",
PackageVersionPolicy.Minor, PackageVersionPolicy.Minor,
["Core.Blueprint.Common", "Thalos.Service.Identity.Abstractions"]); ["Core.Blueprint.Common", "BuildingBlock.Identity.Contracts"]);
} }

View File

@ -1,9 +1,9 @@
using Grpc.Core; using Grpc.Core;
using Microsoft.Extensions.Primitives; using Microsoft.Extensions.Primitives;
using Thalos.Bff.Application.Adapters; using Thalos.Bff.Application.Adapters;
using Thalos.Bff.Application.Contracts;
using Thalos.Service.Grpc; using Thalos.Service.Grpc;
using Thalos.Service.Identity.Abstractions.Contracts; using BuildingBlock.Identity.Contracts.Requests;
using BuildingBlock.Identity.Contracts.Responses;
namespace Thalos.Bff.Rest.Adapters; namespace Thalos.Bff.Rest.Adapters;

View File

@ -24,6 +24,6 @@ public class ContractShapeTests
Assert.Equal("Thalos.Bff.Contracts", contract.Descriptor.PackageId); Assert.Equal("Thalos.Bff.Contracts", contract.Descriptor.PackageId);
Assert.Equal(PackageVersionPolicy.Minor, contract.Descriptor.VersionPolicy); Assert.Equal(PackageVersionPolicy.Minor, contract.Descriptor.VersionPolicy);
Assert.Contains("Core.Blueprint.Common", contract.Descriptor.DependencyPackageIds); Assert.Contains("Core.Blueprint.Common", contract.Descriptor.DependencyPackageIds);
Assert.Contains("Thalos.Service.Identity.Abstractions", contract.Descriptor.DependencyPackageIds); Assert.Contains("BuildingBlock.Identity.Contracts", contract.Descriptor.DependencyPackageIds);
} }
} }

View File

@ -1,9 +1,9 @@
using Thalos.Bff.Application.Contracts;
using Thalos.Bff.Application.Adapters; using Thalos.Bff.Application.Adapters;
using Thalos.Bff.Application.Handlers; using Thalos.Bff.Application.Handlers;
using Thalos.Bff.Application.Security; using Thalos.Bff.Application.Security;
using Thalos.Bff.Contracts.Api; using Thalos.Bff.Contracts.Api;
using Thalos.Service.Identity.Abstractions.Contracts; using BuildingBlock.Identity.Contracts.Requests;
using BuildingBlock.Identity.Contracts.Responses;
namespace Thalos.Bff.Application.UnitTests; namespace Thalos.Bff.Application.UnitTests;

View File

@ -1,8 +1,8 @@
using Thalos.Bff.Application.Adapters; using Thalos.Bff.Application.Adapters;
using Thalos.Bff.Application.Contracts;
using Thalos.Bff.Application.Handlers; using Thalos.Bff.Application.Handlers;
using Thalos.Bff.Contracts.Api; using Thalos.Bff.Contracts.Api;
using Thalos.Service.Identity.Abstractions.Contracts; using BuildingBlock.Identity.Contracts.Requests;
using BuildingBlock.Identity.Contracts.Responses;
namespace Thalos.Bff.Application.UnitTests; namespace Thalos.Bff.Application.UnitTests;