Skip to content

Commit a340869

Browse files
committed
fix: pass ciba user code to verifier
1 parent 1d6df9c commit a340869

3 files changed

Lines changed: 30 additions & 2 deletions

File tree

lib/actions/authorization/ciba_load_account.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export default async function cibaLoadAccount(ctx, next) {
5151
}
5252
ctx.oidc.entity('Account', account);
5353

54-
await ciba.verifyUserCode(ctx, account, value);
54+
await ciba.verifyUserCode(ctx, account, ctx.oidc.params.user_code);
5555

5656
return next();
5757
}

test/ciba/ciba.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ export default {
7777
backchannel_client_notification_endpoint: 'https://rp.example.com/ping',
7878
backchannel_token_delivery_mode: 'ping',
7979
},
80+
{
81+
client_id: 'client-user-code',
82+
grant_types: ['urn:openid:params:grant-type:ciba', 'refresh_token'],
83+
response_types: [],
84+
redirect_uris: [],
85+
token_endpoint_auth_method: 'none',
86+
backchannel_token_delivery_mode: 'poll',
87+
backchannel_user_code_parameter: true,
88+
},
8089
{
8190
client_id: 'client-par-required',
8291
grant_types: ['urn:openid:params:grant-type:ciba', 'refresh_token'],

test/ciba/ciba.test.js

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ describe('features.ciba', () => {
133133
const route = '/backchannel';
134134

135135
it('minimal w/ login_hint', async function () {
136-
const [, [, request, account, client]] = await Promise.all([
136+
const [, [, request, account, client], verifyUserCode] = await Promise.all([
137137
this.agent.post(route)
138138
.send({
139139
scope: 'openid',
@@ -166,6 +166,7 @@ describe('features.ciba', () => {
166166
expect(request.params).to.deep.eql({
167167
client_id: 'client', login_hint: 'accountId', scope: 'openid', extra2: 'defaulted', extra: 'provided',
168168
});
169+
expect(verifyUserCode[2]).to.be.undefined;
169170
});
170171

171172
it('does not require PAR for clients with require_pushed_authorization_requests', async function () {
@@ -183,6 +184,24 @@ describe('features.ciba', () => {
183184
});
184185
});
185186

187+
it('passes user_code to verifyUserCode', async function () {
188+
const [, verifyUserCode] = await Promise.all([
189+
this.agent.post(route)
190+
.send({
191+
scope: 'openid',
192+
login_hint: 'accountId',
193+
user_code: '1234',
194+
client_id: 'client-user-code',
195+
})
196+
.type('form')
197+
.expect(200)
198+
.expect('content-type', /application\/json/),
199+
once(emitter, 'verifyUserCode'),
200+
]);
201+
202+
expect(verifyUserCode[2]).to.equal('1234');
203+
});
204+
186205
it('requested_expiry', async function () {
187206
await this.agent.post(route)
188207
.send({

0 commit comments

Comments
 (0)