Koha-clms/Koha/Auth
Tomás Cohen Arazi 8b1e8f80ba
Bug 43375: Use Mojo json() with form-data fallback for userinfo parsing
This patch simplifies the userinfo response parsing by relying on
Mojo::Message::Response->json which decodes JSON regardless of
Content-Type header parameters. If JSON decoding fails (returns undef),
it falls back to URL-encoded form data parsing.

This fixes integration with APIs that return extra Content-Type
parameters (e.g. Microsoft Graph returns odata.metadata,
odata.streaming, and IEEE754Compatible alongside charset) which
previously caused the strict regex to fail and silently misparse
the response as form data.

Test plan:
1. Apply the regression test (previous patch)
2. Run:
   $ ktd --shell
  k$ prove t/db_dependent/Koha/Auth/Client/OAuth.t
=> FAIL: Subtest fails - Content-Type with extra params not recognized
3. Apply this patch
4. Repeat step 2
=> SUCCESS: All tests pass
5. Sign off :-D

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Pedro Amorim <pedro.amorim@openfifth.co.uk>
2026-09-21 11:11:27 +00:00
..
Client Bug 43375: Use Mojo json() with form-data fallback for userinfo parsing 2026-09-21 11:11:27 +00:00
Identity Bug 32370: Adapt Koha::Auth::Identity::Provider 2026-01-22 10:02:26 -07:00
Client.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
Permissions.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00
TwoFactorAuth.pm Bug 40163: Fix several http addresses in the code docs 2025-09-23 16:21:29 -06:00