Deliver portable native Architecture B deployment and final verification
This commit is contained in:
1 parent
f451b55de1
commit
36740d2492
92 files changed
+10939
-926
No files matched your search
@@ -45,28 +45,29 @@ public sealed class AuthenticationIntegrationTests
|
||||
[Theory]
|
||||
[InlineData("Patient", "test-0")]
|
||||
[InlineData("HealthcareProfessional", "professional")]
|
||||
public async Task Standard_replacement_handler_with_same_identity_retains_ownership_policy(string role,string accountId)
|
||||
public async Task Standard_replacement_handler_with_same_identity_retains_ownership_policy(string role, string accountId)
|
||||
{
|
||||
var fixture=new PatientApiFixture();await fixture.InitializeAsync();
|
||||
var fixture = new PatientApiFixture(); await fixture.InitializeAsync();
|
||||
try
|
||||
{
|
||||
Guid patient=Guid.NewGuid();
|
||||
await using(var db=fixture.CreateDbContext())
|
||||
Guid patient = Guid.NewGuid();
|
||||
await using (var db = fixture.CreateDbContext())
|
||||
{
|
||||
var time=new DateTime(2026,9,12);
|
||||
db.Patients.Add(new HealthApp.Profile.Domain.Patient{PatientId=patient,AccountId="test-0",Name="Replacement",DateOfBirth=new DateOnly(1980,1,1),CreatedAt=time,UpdatedAt=time});await db.SaveChangesAsync();
|
||||
var time = new DateTime(2026, 9, 12);
|
||||
db.Patients.Add(new HealthApp.Profile.Domain.Patient { PatientId = patient, AccountId = "test-0", Name = "Replacement", DateOfBirth = new DateOnly(1980, 1, 1), CreatedAt = time, UpdatedAt = time }); await db.SaveChangesAsync();
|
||||
}
|
||||
fixture.AdditionalGatewayConfiguration["TestIdentity:Role"]=role;fixture.AdditionalGatewayConfiguration["TestIdentity:AccountId"]=accountId;
|
||||
fixture.AdditionalGatewayConfiguration[$"Access:ProfessionalAssignments:{accountId}:0"]=patient.ToString();
|
||||
fixture.ConfigureServices=services=>{
|
||||
services.AddAuthentication().AddScheme<AuthenticationSchemeOptions,ReplacementHandler>("Replacement",null);
|
||||
services.PostConfigure<AuthenticationOptions>(options=>{options.DefaultAuthenticateScheme="Replacement";options.DefaultChallengeScheme="Replacement";options.DefaultScheme="Replacement";});
|
||||
fixture.AdditionalGatewayConfiguration["TestIdentity:Role"] = role; fixture.AdditionalGatewayConfiguration["TestIdentity:AccountId"] = accountId;
|
||||
fixture.AdditionalGatewayConfiguration[$"Access:ProfessionalAssignments:{accountId}:0"] = patient.ToString();
|
||||
fixture.ConfigureServices = services =>
|
||||
{
|
||||
services.AddAuthentication().AddScheme<AuthenticationSchemeOptions, ReplacementHandler>("Replacement", null);
|
||||
services.PostConfigure<AuthenticationOptions>(options => { options.DefaultAuthenticateScheme = "Replacement"; options.DefaultChallengeScheme = "Replacement"; options.DefaultScheme = "Replacement"; });
|
||||
};
|
||||
await fixture.RestartHostsAsync();
|
||||
using var own=await fixture.RawClient.GetAsync($"/api/patients/{patient}");Assert.Equal(HttpStatusCode.OK,own.StatusCode);
|
||||
using var other=await fixture.RawClient.GetAsync($"/api/patients/{Guid.NewGuid()}");Assert.Equal(HttpStatusCode.NotFound,other.StatusCode);Assert.Empty(await other.Content.ReadAsStringAsync());
|
||||
using var own = await fixture.RawClient.GetAsync($"/api/patients/{patient}"); Assert.Equal(HttpStatusCode.OK, own.StatusCode);
|
||||
using var other = await fixture.RawClient.GetAsync($"/api/patients/{Guid.NewGuid()}"); Assert.Equal(HttpStatusCode.NotFound, other.StatusCode); Assert.Empty(await other.Content.ReadAsStringAsync());
|
||||
}
|
||||
finally{await fixture.DisposeAsync();}
|
||||
finally { await fixture.DisposeAsync(); }
|
||||
}
|
||||
|
||||
public sealed class ReplacementHandler(IOptionsMonitor<AuthenticationSchemeOptions> options, ILoggerFactory logger, UrlEncoder encoder, IConfiguration configuration)
|
||||
|
||||
Reference in new issue
Block a user