From c5a3c0d71f9c03d5e9c720d6d2b5e4c0fd1166b8 Mon Sep 17 00:00:00 2001 From: Joachim Van Herwegen Date: Mon, 7 Jul 2025 13:52:32 +0200 Subject: [PATCH] feat: Allow APIs with raw input Some APIs might need non-JSON/form input, this allows this possibility. In the future we probably want a more generic solution, but for now this at least allows the possibility. --- packages/uma/config/default.json | 54 ++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 20 deletions(-) diff --git a/packages/uma/config/default.json b/packages/uma/config/default.json index c9a41ab8..526d739b 100644 --- a/packages/uma/config/default.json +++ b/packages/uma/config/default.json @@ -88,27 +88,41 @@ "@id": "urm:uma:default:JsonHttpErrorHandler", "@type": "JsonHttpErrorHandler", "handler": { - "@id": "urm:uma:default:JsonFormHttpHandler", - "@type": "JsonFormHttpHandler", - "handler": { - "@id": "urn:uma:default:RoutedHttpRequestHandler", - "@type": "RoutedHttpRequestHandler", - "routes": [ - { "@id": "urn:uma:default:UmaConfigRoute" }, - { "@id": "urn:uma:default:JwksRoute" }, - { "@id": "urn:uma:default:TokenRoute" }, - { "@id": "urn:uma:default:PermissionRegistrationRoute" }, - { "@id": "urn:uma:default:ResourceRegistrationRoute" }, - { "@id": "urn:uma:default:ResourceRegistrationOpsRoute" }, - { "@id": "urn:uma:default:IntrospectionRoute" }, - { "@id": "urn:uma:default:LogRoute" }, - { "@id": "urn:uma:default:VCRoute" }, - { "@id": "urn:uma:default:ContractRoute" } - ], - "defaultHandler": { - "@type": "DefaultRequestHandler" + "@id": "urm:uma:default:RouteHandler", + "@type": "WaterfallHandler", + "handlers": [ + { + "comment": "Handles all JSON and form encoded input/output.", + "@id": "urm:uma:default:JsonFormHttpHandler", + "@type": "JsonFormHttpHandler", + "handler": { + "@id": "urn:uma:default:JsonRoutedHttpRequestHandler", + "@type": "RoutedHttpRequestHandler", + "routes": [ + { "@id": "urn:uma:default:UmaConfigRoute" }, + { "@id": "urn:uma:default:JwksRoute" }, + { "@id": "urn:uma:default:TokenRoute" }, + { "@id": "urn:uma:default:PermissionRegistrationRoute" }, + { "@id": "urn:uma:default:ResourceRegistrationRoute" }, + { "@id": "urn:uma:default:ResourceRegistrationOpsRoute" }, + { "@id": "urn:uma:default:IntrospectionRoute" } + ], + "defaultHandler": { + "@type": "DefaultRequestHandler" + } + } + }, + { + "comment": "Handles all remaining output. These handlers have to handle input/output parsing themselves. TODO: At some point we want more generic conneg.", + "@id": "urn:uma:default:RawRoutedHttpRequestHandler", + "@type": "RoutedHttpRequestHandler", + "routes": [ + { "@id": "urn:uma:default:ContractRoute" }, + { "@id": "urn:uma:default:LogRoute" }, + { "@id": "urn:uma:default:VCRoute" } + ] } - } + ] } } },