fix: include customer cross-border authorities overseas

This commit is contained in:
2026-09-04 13:15:28 +08:00
parent 54cb9ceade
commit 81470359f2
2 changed files with 6 additions and 2 deletions
@@ -32,6 +32,7 @@ public class OverseasTokenService {
"platform:overseas-business:", "platform:overseas-business:",
"platform:overseas-master-data:", "platform:overseas-master-data:",
"merchant:warehouse:", "merchant:warehouse:",
"merchant:cross-border:",
"platform:finance:", "platform:finance:",
"lastleg:" "lastleg:"
); );
@@ -50,12 +50,14 @@ class OverseasTokenServiceTest {
account.setDefaultMembershipId(84L); account.setDefaultAppCode("MERCHANT"); account.setDefaultMembershipId(84L); account.setDefaultAppCode("MERCHANT");
String authority = "platform:overseas-master-data:quote:list"; String authority = "platform:overseas-master-data:quote:list";
String merchantAuthority = "merchant:warehouse:delivery:list"; String merchantAuthority = "merchant:warehouse:delivery:list";
String merchantCrossBorderAuthority = "merchant:cross-border:procurement";
String lastlegAuthority = "lastleg:pda:operate"; String lastlegAuthority = "lastleg:pda:operate";
String financeAuthority = "platform:finance:fee-source:edit"; String financeAuthority = "platform:finance:fee-source:edit";
String domesticAuthority = "platform:firstleg:order:list"; String domesticAuthority = "platform:firstleg:order:list";
AuthorizationSnapshot snapshot = new AuthorizationSnapshot(42L, 0L, 84L, "PLATFORM", "WEB", AuthorizationSnapshot snapshot = new AuthorizationSnapshot(42L, 0L, 84L, "PLATFORM", "WEB",
Set.of("OVERSEAS_WAREHOUSE_PDA_OPERATOR"), Set.of("OVERSEAS_WAREHOUSE_PDA_OPERATOR"),
Set.of(authority, merchantAuthority, lastlegAuthority, financeAuthority, domesticAuthority), 7L, 900L); Set.of(authority, merchantAuthority, merchantCrossBorderAuthority, lastlegAuthority,
financeAuthority, domesticAuthority), 7L, 900L);
Jwt encoded = org.mockito.Mockito.mock(Jwt.class); Jwt encoded = org.mockito.Mockito.mock(Jwt.class);
when(accounts.findById(42L)).thenReturn(account); when(accounts.findById(42L)).thenReturn(account);
when(authorizationLoader.load(account)).thenReturn(snapshot); when(authorizationLoader.load(account)).thenReturn(snapshot);
@@ -78,7 +80,8 @@ class OverseasTokenServiceTest {
.containsEntry("token_version", 0) .containsEntry("token_version", 0)
.containsEntry("overseas_warehouse_id", 900L) .containsEntry("overseas_warehouse_id", 900L)
.containsEntry("roles", Set.of("OVERSEAS_WAREHOUSE_PDA_OPERATOR")) .containsEntry("roles", Set.of("OVERSEAS_WAREHOUSE_PDA_OPERATOR"))
.containsEntry("authorities", Set.of(authority, merchantAuthority, lastlegAuthority, financeAuthority)) .containsEntry("authorities", Set.of(authority, merchantAuthority, merchantCrossBorderAuthority,
lastlegAuthority, financeAuthority))
.doesNotContainKeys("userId", "tenantId", "appCode", "permissionVersion"); .doesNotContainKeys("userId", "tenantId", "appCode", "permissionVersion");
assertThat(response.expiresIn()).isEqualTo(900); assertThat(response.expiresIn()).isEqualTo(900);
} }