@canton-network/wallet-gateway-remote 1.11.1 → 1.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -836,32 +836,6 @@ describe('userController', () => {
|
|
|
836
836
|
networkId: 'network1',
|
|
837
837
|
})).rejects.toThrow('Failed to add session');
|
|
838
838
|
});
|
|
839
|
-
it('addSession rejects token with client_id claim and auth.clientId mismatch', async () => {
|
|
840
|
-
const authWithInvalidSubject = createAuthWithAddSessionClaims({
|
|
841
|
-
client_id: 'wrong-client-id',
|
|
842
|
-
});
|
|
843
|
-
const store = await createStore(logger, authWithInvalidSubject, {
|
|
844
|
-
withWallet: false,
|
|
845
|
-
});
|
|
846
|
-
const controller = createController(store, notificationService, logger, authWithInvalidSubject);
|
|
847
|
-
await expect(controller.addSession({
|
|
848
|
-
origin: 'dapp-1',
|
|
849
|
-
networkId: 'network1',
|
|
850
|
-
})).rejects.toThrow('Failed to add session');
|
|
851
|
-
});
|
|
852
|
-
it('addSession rejects token with azp claim and auth.clientId mismatch', async () => {
|
|
853
|
-
const authWithInvalidSubject = createAuthWithAddSessionClaims({
|
|
854
|
-
azp: 'wrong-client-id',
|
|
855
|
-
});
|
|
856
|
-
const store = await createStore(logger, authWithInvalidSubject, {
|
|
857
|
-
withWallet: false,
|
|
858
|
-
});
|
|
859
|
-
const controller = createController(store, notificationService, logger, authWithInvalidSubject);
|
|
860
|
-
await expect(controller.addSession({
|
|
861
|
-
origin: 'dapp-1',
|
|
862
|
-
networkId: 'network1',
|
|
863
|
-
})).rejects.toThrow('Failed to add session');
|
|
864
|
-
});
|
|
865
839
|
it("addSession passes when token doesn't token have azp and client-id claims", async () => {
|
|
866
840
|
const authWithInvalidSubject = createAuthWithAddSessionClaims();
|
|
867
841
|
const store = await createStore(logger, authWithInvalidSubject, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"token-network-matching.d.ts","sourceRoot":"","sources":["../../src/user-api/token-network-matching.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,kCAAkC,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAe3D,wBAAgB,6BAA6B,CACzC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,GACT,IAAI,
|
|
1
|
+
{"version":3,"file":"token-network-matching.d.ts","sourceRoot":"","sources":["../../src/user-api/token-network-matching.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,GAAG,EAAE,MAAM,kCAAkC,CAAA;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,mCAAmC,CAAA;AAe3D,wBAAgB,6BAA6B,CACzC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,GACT,IAAI,CAcN"}
|
|
@@ -21,9 +21,4 @@ export function assertTokenClaimsMatchNetwork(accessToken, network, idp) {
|
|
|
21
21
|
if (!tokenAudiences.includes(network.auth.audience)) {
|
|
22
22
|
throw new Error(`Token aud claim doesn't match network's auth audience.`);
|
|
23
23
|
}
|
|
24
|
-
// check client ID based on `azp` (Authorized Party) claim or `client_id` claim, only if present.
|
|
25
|
-
const tokenClientId = tokenClaims.azp || tokenClaims.client_id;
|
|
26
|
-
if (tokenClientId && tokenClientId !== network.auth.clientId) {
|
|
27
|
-
throw new Error(`Token client ID doesn't match network's auth clientId.`);
|
|
28
|
-
}
|
|
29
24
|
}
|