From 2d857688eb2bfc0fab6b2f02c3ffbf2b953442f7 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Wed, 24 Mar 2021 16:41:54 +0100 Subject: [PATCH] fix: interaction uid is now an alias to its jti, it is not stored anymore either --- example/my_adapter.js | 1 - lib/actions/authorization/interactions.js | 1 - lib/models/interaction.js | 15 +++++++++++---- test/configuration/interaction_url.test.js | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/example/my_adapter.js b/example/my_adapter.js index 277b84f14..fcee2bf9e 100644 --- a/example/my_adapter.js +++ b/example/my_adapter.js @@ -128,7 +128,6 @@ class MyAdapter { * - kind {string} - "Interaction" fixed string value * - exp {number} - timestamp of the interaction's expiration * - iat {number} - timestamp of the interaction's creation - * - uid {string} - the uid of the authorizing client's established session * - returnTo {string} - after resolving interactions send the user-agent to this url * - deviceCode {string} - [DeviceCode user flows only] deviceCode reference * - params {object} - parsed recognized parameters object diff --git a/lib/actions/authorization/interactions.js b/lib/actions/authorization/interactions.js index 32406d47d..ff19e8a08 100644 --- a/lib/actions/authorization/interactions.js +++ b/lib/actions/authorization/interactions.js @@ -105,7 +105,6 @@ module.exports = async function interactions(resumeRouteName, ctx, next) { prompt, lastSubmission: oidc.result, accountId: oidc.session.accountId, - uid, params: oidc.params.toPlainObject(), trusted: oidc.trusted, session: oidc.session, diff --git a/lib/models/interaction.js b/lib/models/interaction.js index 038670ee6..78c1cd26b 100644 --- a/lib/models/interaction.js +++ b/lib/models/interaction.js @@ -4,7 +4,7 @@ const epochTime = require('../helpers/epoch_time'); const hasFormat = require('./mixins/has_format'); module.exports = (provider) => class Interaction extends hasFormat(provider, 'Interaction', instance(provider).BaseModel) { - constructor(id, payload) { + constructor(jti, payload) { if (arguments.length === 2) { if (payload.session instanceof instance(provider).BaseModel) { const { session } = payload; @@ -26,12 +26,20 @@ module.exports = (provider) => class Interaction extends hasFormat(provider, 'In } } - super({ ...payload, jti: id }); + super({ jti, ...payload }); } else { - super(id); + super(jti); } } + get uid() { + return this.jti; + } + + set uid(value) { + this.jti = value; + } + async save(ttl) { if (typeof ttl !== 'number') { throw new TypeError('"ttl" argument must be a number'); @@ -56,7 +64,6 @@ module.exports = (provider) => class Interaction extends hasFormat(provider, 'In 'returnTo', 'signed', 'grantId', - 'uid', 'lastSubmission', 'deviceCode', ]; diff --git a/test/configuration/interaction_url.test.js b/test/configuration/interaction_url.test.js index d02166454..2d0bb2f68 100644 --- a/test/configuration/interaction_url.test.js +++ b/test/configuration/interaction_url.test.js @@ -16,7 +16,7 @@ describe('pathFor related behaviors', () => { }, }); - const url = await i(provider).configuration('interactions.url')({}, { uid: 'foobar' }); + const url = await i(provider).configuration('interactions.url')({}, new provider.Interaction('foobar', {})); expect(url).to.equal('/interaction/foobar'); });