diff --git a/certification/configuration.js b/certification/configuration.js index a14436b21..63e9fa7a3 100644 --- a/certification/configuration.js +++ b/certification/configuration.js @@ -63,7 +63,6 @@ module.exports = { features: { backchannelLogout: { enabled: true }, devInteractions: { enabled: false }, - ietfJWTAccessTokenProfile: { enabled: true }, mTLS: { enabled: true, certificateBoundAccessTokens: true, diff --git a/docs/README.md b/docs/README.md index 338ccac08..8a5cd9479 100644 --- a/docs/README.md +++ b/docs/README.md @@ -185,17 +185,17 @@ packing the results. See them used in the [step-by-step](https://github.com/panv or [in-repo](/example) examples. -**`#provider.interactionDetails(req)`** +**`#provider.interactionDetails(req, res)`** ```js // with express expressApp.get('/interaction/:uid', async (req, res) => { - const details = await provider.interactionDetails(req); + const details = await provider.interactionDetails(req, res); // ... }); // with koa router.get('/interaction/:uid', async (ctx, next) => { - const details = await provider.interactionDetails(ctx.req); + const details = await provider.interactionDetails(ctx.req, ctx.res); // ... }); ``` diff --git a/example/routes/express.js b/example/routes/express.js index d6667305e..df50a3960 100644 --- a/example/routes/express.js +++ b/example/routes/express.js @@ -48,7 +48,7 @@ module.exports = (app, provider) => { try { const { uid, prompt, params, session, - } = await provider.interactionDetails(req); + } = await provider.interactionDetails(req, res); const client = await provider.Client.find(params.client_id); @@ -113,7 +113,7 @@ module.exports = (app, provider) => { app.post('/interaction/:uid/login', setNoCache, body, async (req, res, next) => { try { - const { prompt: { name } } = await provider.interactionDetails(req); + const { prompt: { name } } = await provider.interactionDetails(req, res); assert.equal(name, 'login'); const account = await Account.findByLogin(req.body.login); @@ -133,7 +133,7 @@ module.exports = (app, provider) => { app.post('/interaction/:uid/continue', setNoCache, body, async (req, res, next) => { try { - const interaction = await provider.interactionDetails(req); + const interaction = await provider.interactionDetails(req, res); const { prompt: { name, details } } = interaction; assert.equal(name, 'select_account'); @@ -157,7 +157,7 @@ module.exports = (app, provider) => { app.post('/interaction/:uid/confirm', setNoCache, body, async (req, res, next) => { try { - const { prompt: { name, details } } = await provider.interactionDetails(req); + const { prompt: { name, details } } = await provider.interactionDetails(req, res); assert.equal(name, 'consent'); const consent = {}; diff --git a/example/routes/koa.js b/example/routes/koa.js index 2ce7a5ad4..e19c7150d 100644 --- a/example/routes/koa.js +++ b/example/routes/koa.js @@ -44,7 +44,7 @@ module.exports = (provider) => { router.get('/interaction/:uid', async (ctx, next) => { const { uid, prompt, params, session, - } = await provider.interactionDetails(ctx.req); + } = await provider.interactionDetails(ctx.req, ctx.res); const client = await provider.Client.find(params.client_id); switch (prompt.name) { @@ -113,7 +113,7 @@ module.exports = (provider) => { router.get('/interaction/callback/google', (ctx) => ctx.render('repost', { provider: 'google', layout: false })); router.post('/interaction/:uid/login', body, async (ctx) => { - const { prompt: { name } } = await provider.interactionDetails(ctx.req); + const { prompt: { name } } = await provider.interactionDetails(ctx.req, ctx.res); assert.equal(name, 'login'); const account = await Account.findByLogin(ctx.request.body.login); @@ -132,7 +132,7 @@ module.exports = (provider) => { }); router.post('/interaction/:uid/federated', body, async (ctx) => { - const { prompt: { name } } = await provider.interactionDetails(ctx.req); + const { prompt: { name } } = await provider.interactionDetails(ctx.req, ctx.res); assert.equal(name, 'login'); const path = `/interaction/${ctx.params.uid}/federated`; @@ -177,7 +177,7 @@ module.exports = (provider) => { }); router.post('/interaction/:uid/continue', body, async (ctx) => { - const interaction = await provider.interactionDetails(ctx.req); + const interaction = await provider.interactionDetails(ctx.req, ctx.res); const { prompt: { name, details } } = interaction; assert.equal(name, 'select_account'); @@ -199,7 +199,7 @@ module.exports = (provider) => { }); router.post('/interaction/:uid/confirm', body, async (ctx) => { - const { prompt: { name, details } } = await provider.interactionDetails(ctx.req); + const { prompt: { name, details } } = await provider.interactionDetails(ctx.req, ctx.res); assert.equal(name, 'consent'); const consent = {}; diff --git a/lib/actions/interaction.js b/lib/actions/interaction.js index fd81197ee..9d06d35c4 100644 --- a/lib/actions/interaction.js +++ b/lib/actions/interaction.js @@ -43,7 +43,7 @@ your configuration is not in effect'); async function interactionRender(ctx, next) { const { uid, prompt, params, session, - } = await provider.interactionDetails(ctx.req); + } = await provider.interactionDetails(ctx.req, ctx.res); const client = await provider.Client.find(params.client_id); let view; @@ -102,7 +102,7 @@ your configuration is not in effect'); parseBody, async function interactionSubmit(ctx, next) { ctx.oidc.uid = ctx.params.uid; - const { prompt: { name } } = await provider.interactionDetails(ctx.req); + const { prompt: { name } } = await provider.interactionDetails(ctx.req, ctx.res); switch (ctx.oidc.body.prompt) { // eslint-disable-line default-case case 'login': { assert.equal(name, 'login'); diff --git a/lib/provider.js b/lib/provider.js index 947e0e9c7..f6966f17d 100644 --- a/lib/provider.js +++ b/lib/provider.js @@ -206,8 +206,13 @@ class Provider extends events.EventEmitter { * @name interactionDetails * @api public */ - async interactionDetails(req) { - return getInteraction.call(this, req); + async interactionDetails(req, res) { + /* istanbul ignore if */ + if (typeof res === 'undefined') { // TODO: in v7.x deprecate only req + return getInteraction.call(this, req); + } + + return getInteraction.call(this, req, res); } /**