Skip to content

Commit 8167bd0

Browse files
authored
fix: required PAR should not affect CIBA and DAG
1 parent 3aec506 commit 8167bd0

File tree

5 files changed

+53
-1
lines changed

5 files changed

+53
-1
lines changed

lib/actions/authorization/process_request_object.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default async function processRequestObject(PARAM_LIST, rejectDupesMiddle
1111
const { params, client, route } = ctx.oidc;
1212

1313
const pushedRequestObject = 'PushedAuthorizationRequest' in ctx.oidc.entities;
14-
if (client.requirePushedAuthorizationRequests && route !== 'pushed_authorization_request' && !pushedRequestObject) {
14+
if (client.requirePushedAuthorizationRequests && route === 'authorization' && !pushedRequestObject) {
1515
throw new InvalidRequest('Pushed Authorization Request must be used');
1616
}
1717

test/ciba/ciba.config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,15 @@ export default {
7979
backchannel_client_notification_endpoint: 'https://rp.example.com/ping',
8080
backchannel_token_delivery_mode: 'ping',
8181
},
82+
{
83+
client_id: 'client-par-required',
84+
grant_types: ['urn:openid:params:grant-type:ciba', 'refresh_token'],
85+
response_types: [],
86+
redirect_uris: [],
87+
token_endpoint_auth_method: 'none',
88+
backchannel_token_delivery_mode: 'poll',
89+
require_pushed_authorization_requests: true,
90+
},
8291
{
8392
client_id: 'client-signed',
8493
grant_types: ['urn:openid:params:grant-type:ciba', 'refresh_token'],

test/ciba/ciba.test.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,21 @@ describe('features.ciba', () => {
168168
});
169169
});
170170

171+
it('does not require PAR for clients with require_pushed_authorization_requests', async function () {
172+
return this.agent.post(route)
173+
.send({
174+
scope: 'openid',
175+
login_hint: 'accountId',
176+
client_id: 'client-par-required',
177+
})
178+
.type('form')
179+
.expect(200)
180+
.expect('content-type', /application\/json/)
181+
.expect((response) => {
182+
expect(response.body).to.have.keys('expires_in', 'auth_req_id');
183+
});
184+
});
185+
171186
it('requested_expiry', async function () {
172187
await this.agent.post(route)
173188
.send({

test/device_code/device_authorization_endpoint.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,26 @@ describe('device_authorization_endpoint', () => {
149149
expect(dc.params).not.to.have.property('response_mode');
150150
});
151151

152+
it('does not require PAR for clients with require_pushed_authorization_requests', function () {
153+
return this.agent.post(route)
154+
.send({
155+
client_id: 'client-par-required',
156+
scope: 'openid',
157+
})
158+
.type('form')
159+
.expect(200)
160+
.expect('content-type', /application\/json/)
161+
.expect(({ body }) => {
162+
expect(body).to.have.keys([
163+
'device_code',
164+
'user_code',
165+
'verification_uri',
166+
'verification_uri_complete',
167+
'expires_in',
168+
]);
169+
});
170+
});
171+
152172
it('handles regular client auth', function () {
153173
return this.agent.post(route)
154174
.auth('client-basic-auth', 'secret')

test/device_code/device_code.config.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ export default {
2929
redirect_uris: [],
3030
token_endpoint_auth_method: 'none',
3131
application_type: 'native',
32+
}, {
33+
client_id: 'client-par-required',
34+
grant_types: ['urn:ietf:params:oauth:grant-type:device_code', 'refresh_token'],
35+
response_types: [],
36+
redirect_uris: [],
37+
token_endpoint_auth_method: 'none',
38+
application_type: 'native',
39+
require_pushed_authorization_requests: true,
3240
}, {
3341
client_id: 'client-other',
3442
grant_types: ['urn:ietf:params:oauth:grant-type:device_code', 'refresh_token'],

0 commit comments

Comments
 (0)