Skip to content

Commit 089fa43

Browse files
committed
refactor!: CIBA and PAR do not automatically turn on JAR
BREAKING CHANGE: The combination of FAPI and CIBA features no longer forces CIBA clients to use JAR. To continue conforming to a given FAPI CIBA profile that requires the use of JAR either set `features.requestObjects.requireSignedRequestObject` to `true` as a global policy or set `require_signed_request_object` or `backchannel_authentication_request_signing_alg` client metadata. BREAKING CHANGE: PAR no longer automatically enables the support for JAR. To support PAR with JAR configure both `features.pushedAuthorizationRequests` and `features.requestObjects.request`. BREAKING CHANGE: CIBA no longer automatically enables the support for JAR. To support CIBA with JAR configure both `features.ciba` and `features.requestObjects.request`.
1 parent 4272027 commit 089fa43

13 files changed

+1206
-1094
lines changed

docs/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ _**default value**_:
638638

639639
[OpenID Connect Client Initiated Backchannel Authentication Flow - Core 1.0](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0-final.html)
640640

641-
Enables Core CIBA Flow, when combined with `features.fapi` enables [Financial-grade API: Client Initiated Backchannel Authentication Profile - Implementer's Draft 01](https://openid.net/specs/openid-financial-api-ciba-ID1.html) as well.
641+
Enables Core CIBA Flow, when combined with `features.fapi` and `features.requestObjects.request` enables [Financial-grade API: Client Initiated Backchannel Authentication Profile - Implementer's Draft 01](https://openid.net/specs/openid-financial-api-ciba-ID1.html) as well.
642642

643643

644644

lib/actions/authorization/fetch_request_uri.js

+3-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { URL } from 'node:url';
22

3-
import { InvalidRequestUri } from '../../helpers/errors.js';
3+
import { InvalidRequestUri, RequestUriNotSupported } from '../../helpers/errors.js';
44
import instance from '../../helpers/weak_cache.js';
55
import { PUSHED_REQUEST_URN } from '../../consts/index.js';
66

@@ -15,11 +15,8 @@ const allowedSchemes = new Set(['http:', 'https:', 'urn:']);
1515
* uses the response body as a value for the request parameter to be validated by a downstream
1616
* middleware
1717
*
18-
*
19-
* @throws: invalid_request
2018
* @throws: invalid_request_uri
21-
* @throws: request_not_supported
22-
* @throws: request_uri_not_supported
19+
* @throws: request_uri_not_allowed
2320
*/
2421
export default async function fetchRequestUri(ctx, next) {
2522
const { pushedAuthorizationRequests, requestObjects } = instance(ctx.oidc.provider).configuration('features');
@@ -44,7 +41,7 @@ export default async function fetchRequestUri(ctx, next) {
4441
) {
4542
loadedRequestObject = await loadPushedAuthorizationRequest(ctx);
4643
} else if (!loadedRequestObject && !requestObjects.requestUri) {
47-
throw new InvalidRequestUri('only request_uri values from the pushed_authorization_request_endpoint are allowed');
44+
throw new RequestUriNotSupported();
4845
} else if (!loadedRequestObject && ctx.oidc.client.requestUris) {
4946
if (!ctx.oidc.client.requestUriAllowed(params.request_uri)) {
5047
throw new InvalidRequestUri('provided request_uri is not allowed');

lib/actions/authorization/process_request_object.js

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ export default async function processRequestObject(PARAM_LIST, rejectDupesMiddle
2828
&& (
2929
client.requireSignedRequestObject
3030
|| (client.backchannelAuthenticationRequestSigningAlg && isBackchannelAuthentication)
31-
|| (ctx.oidc.fapiProfile !== undefined && isBackchannelAuthentication)
3231
)
3332
) {
3433
throw new InvalidRequest('Request Object must be used by this client');

lib/actions/authorization/reject_unsupported.js

+3-7
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,13 @@ export default function rejectUnsupported(ctx, next) {
1111
const { requestObjects, pushedAuthorizationRequests } = instance(ctx.oidc.provider).configuration('features');
1212
const { params } = ctx.oidc;
1313

14-
if (
15-
!requestObjects.request
16-
&& params.request !== undefined
17-
&& (ctx.oidc.route !== 'pushed_authorization_request' && ctx.oidc.route !== 'backchannel_authentication')
18-
) {
14+
if (params.request !== undefined && !requestObjects.request) {
1915
throw new RequestNotSupported();
2016
}
2117

2218
if (
23-
(!requestObjects.requestUri && !pushedAuthorizationRequests.enabled)
24-
&& params.request_uri !== undefined
19+
params.request_uri !== undefined
20+
&& !(requestObjects.requestUri || pushedAuthorizationRequests.enabled)
2521
) {
2622
throw new RequestUriNotSupported();
2723
}

lib/actions/discovery.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,10 @@ export default function discovery(ctx, next) {
3737
ctx.body.require_pushed_authorization_requests = pushedAuthorizationRequests.requirePushedAuthorizationRequests ? true : undefined;
3838
}
3939

40-
if (requestObjects.request || requestObjects.requestUri || pushedAuthorizationRequests.enabled) {
40+
ctx.body.request_parameter_supported = requestObjects.request;
41+
ctx.body.request_uri_parameter_supported = requestObjects.requestUri;
42+
if (requestObjects.request || requestObjects.requestUri) {
4143
ctx.body.request_object_signing_alg_values_supported = config.requestObjectSigningAlgValues;
42-
ctx.body.request_parameter_supported = requestObjects.request;
43-
ctx.body.request_uri_parameter_supported = requestObjects.requestUri;
4444
ctx.body.require_request_uri_registration = requestObjects.requestUri && requestObjects.requireUriRegistration ? true : undefined;
4545
ctx.body.require_signed_request_object = requestObjects.requireSignedRequestObject ? true : undefined;
4646
}
@@ -105,7 +105,7 @@ export default function discovery(ctx, next) {
105105
ctx.body.authorization_encryption_enc_values_supported = config.authorizationEncryptionEncValues;
106106
}
107107

108-
if (requestObjects.request || requestObjects.requestUri || pushedAuthorizationRequests.enabled) {
108+
if (requestObjects.request || requestObjects.requestUri) {
109109
ctx.body.request_object_encryption_alg_values_supported = config.requestObjectEncryptionAlgValues;
110110
ctx.body.request_object_encryption_enc_values_supported = config.requestObjectEncryptionEncValues;
111111
}
@@ -124,7 +124,7 @@ export default function discovery(ctx, next) {
124124
ctx.body.backchannel_authentication_endpoint = ctx.oidc.urlFor('backchannel_authentication');
125125
ctx.body.backchannel_token_delivery_modes_supported = [...features.ciba.deliveryModes];
126126
ctx.body.backchannel_user_code_parameter_supported = true;
127-
ctx.body.backchannel_authentication_request_signing_alg_values_supported = config.requestObjectSigningAlgValues.filter((alg) => !alg.startsWith('HS'));
127+
ctx.body.backchannel_authentication_request_signing_alg_values_supported = requestObjects.request ? config.requestObjectSigningAlgValues.filter((alg) => !alg.startsWith('HS')) : undefined;
128128
}
129129

130130
defaults(ctx.body, config.discovery);

lib/helpers/client_schema.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ export default function getSchema(provider) {
8888
if (
8989
features.requestObjects.request
9090
|| features.requestObjects.requestUri
91-
|| features.pushedAuthorizationRequests.enabled
9291
) {
9392
RECOGNIZED_METADATA.push('request_object_signing_alg');
9493
RECOGNIZED_METADATA.push('require_signed_request_object');
@@ -141,7 +140,9 @@ export default function getSchema(provider) {
141140
RECOGNIZED_METADATA.push('backchannel_token_delivery_mode');
142141
RECOGNIZED_METADATA.push('backchannel_user_code_parameter');
143142
RECOGNIZED_METADATA.push('backchannel_client_notification_endpoint');
144-
RECOGNIZED_METADATA.push('backchannel_authentication_request_signing_alg');
143+
if (features.requestObjects.request) {
144+
RECOGNIZED_METADATA.push('backchannel_authentication_request_signing_alg');
145+
}
145146
}
146147

147148
if (features.dPoP.enabled) {
@@ -597,11 +598,10 @@ export default function getSchema(provider) {
597598
}
598599

599600
jarPolicy() {
600-
const { features: { requestObjects, pushedAuthorizationRequests } } = configuration;
601+
const { features: { requestObjects } } = configuration;
601602

602603
const enabled = requestObjects.request
603-
|| requestObjects.requestUri
604-
|| pushedAuthorizationRequests.enabled;
604+
|| requestObjects.requestUri;
605605

606606
if (enabled) {
607607
if (requestObjects.requireSignedRequestObject) {

lib/helpers/defaults.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ function makeDefaults() {
921921
*
922922
* title: [OpenID Connect Client Initiated Backchannel Authentication Flow - Core 1.0](https://openid.net/specs/openid-client-initiated-backchannel-authentication-core-1_0-final.html)
923923
*
924-
* description: Enables Core CIBA Flow, when combined with `features.fapi` enables [Financial-grade API: Client Initiated Backchannel Authentication Profile - Implementer's Draft 01](https://openid.net/specs/openid-financial-api-ciba-ID1.html) as well.
924+
* description: Enables Core CIBA Flow, when combined with `features.fapi` and `features.requestObjects.request` enables [Financial-grade API: Client Initiated Backchannel Authentication Profile - Implementer's Draft 01](https://openid.net/specs/openid-financial-api-ciba-ID1.html) as well.
925925
*
926926
*/
927927
ciba: {

0 commit comments

Comments
 (0)