From 122bd7b574c3c684b8babceef3601d652d6adf4b Mon Sep 17 00:00:00 2001 From: Timo Hocker <35867059+TimoHocker@users.noreply.github.com> Date: Wed, 3 Aug 2022 16:21:00 +0200 Subject: [PATCH] fix refresh data carrying --- lib/Gateway.ts | 2 +- package.json | 2 +- test/spec/Gateway.ts | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/Gateway.ts b/lib/Gateway.ts index 1deeded..6ea1368 100644 --- a/lib/Gateway.ts +++ b/lib/Gateway.ts @@ -139,7 +139,7 @@ class GatewayClass { const con = req.connection as unknown as Record; con.auth = { token_id: refresh_result.access_token_id, - token_data: this._options.refresh_settings.data + token_data: ver.data }; logger ('tokens refreshed'); diff --git a/package.json b/package.json index 04877b9..bf6cd62 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@sapphirecode/auth-server-helper", - "version": "3.2.0", + "version": "3.2.1", "main": "dist/index.js", "author": { "name": "Timo Hocker", diff --git a/test/spec/Gateway.ts b/test/spec/Gateway.ts index 55f14b8..0c7befd 100644 --- a/test/spec/Gateway.ts +++ b/test/spec/Gateway.ts @@ -81,8 +81,12 @@ describe ('gateway', () => { }); it ('should automatically return new tokens', async () => { - const token = await authority.sign ('access_token', 60); - const refresh = await authority.sign ('refresh_token', 3600); + const token = await authority.sign ('access_token', 60, { data: 'foobar' }); + const refresh = await authority.sign ( + 'refresh_token', + 3600, + { data: 'foobar' } + ); jasmine.clock () .tick (70000); const resp = await get ( @@ -94,6 +98,8 @@ describe ('gateway', () => { expect (JSON.parse (resp.body as string).token_id) .not .toEqual (token.id); + expect (JSON.parse (resp.body as string).token_data) + .toEqual ('foobar'); }); it ('should correctly deliver token data', async () => {