test(security): invalidate data scope snapshots
This commit is contained in:
@@ -3,6 +3,8 @@ using System.Net.Http.Json;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Tiku.Api.Contracts;
|
||||
using Tiku.Application.Auth;
|
||||
using Tiku.Application.Security;
|
||||
using Tiku.Domain.Catalog;
|
||||
using Tiku.Domain.Common;
|
||||
using Tiku.Domain.Content;
|
||||
@@ -305,6 +307,8 @@ public sealed class ContentManagementEndpointTests
|
||||
item.TenantId == tenantId && item.Code == "integration_test_admin");
|
||||
role.DataScope = JsonSerializer.SerializeToElement(value);
|
||||
await dbContext.SaveChangesAsync();
|
||||
await scope.ServiceProvider.GetRequiredService<IAuthorizationStateInvalidator>()
|
||||
.BumpScopeAsync(AuthRealm.Tenant, tenantId);
|
||||
}
|
||||
|
||||
private static async Task<JsonDocument> ReadJsonAsync(HttpResponseMessage response)
|
||||
@@ -312,4 +316,4 @@ public sealed class ContentManagementEndpointTests
|
||||
var stream = await response.Content.ReadAsStreamAsync();
|
||||
return await JsonDocument.ParseAsync(stream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Tiku.Api.Contracts;
|
||||
using Tiku.Application.Commerce;
|
||||
using Tiku.Application.Jobs;
|
||||
using Tiku.Application.Auth;
|
||||
using Tiku.Application.Security;
|
||||
using Tiku.Domain.Catalog;
|
||||
using Tiku.Domain.Commerce;
|
||||
using Tiku.Domain.Identity;
|
||||
@@ -676,6 +678,8 @@ public sealed class TenantCommerceEndpointTests
|
||||
item.TenantId == tenantId && item.Code == "integration_test_admin");
|
||||
role.DataScope = JsonSerializer.SerializeToElement(value);
|
||||
await dbContext.SaveChangesAsync();
|
||||
await scope.ServiceProvider.GetRequiredService<IAuthorizationStateInvalidator>()
|
||||
.BumpScopeAsync(AuthRealm.Tenant, tenantId);
|
||||
}
|
||||
|
||||
private sealed record LoginSeed(Guid TenantId, Guid UserId, string Phone);
|
||||
@@ -698,4 +702,4 @@ public sealed class TenantCommerceEndpointTests
|
||||
throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user