https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43077

--- Comment #1 from Tomás Cohen Arazi (tcohen) <[email protected]> ---
Created attachment 201951
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201951&action=edit
Bug 43077: Add encode_claims/decode_claims to Koha::Token

This patch adds two methods to Koha::Token for encoding and decoding
arbitrary claims as signed JWTs:

- encode_claims($hashref) - encodes any hashref as a signed JWT
- decode_claims($token) - decodes a JWT and returns the full claims

Unlike the existing generate_jwt/decode_jwt methods (which only support
a single 'id' string value), these methods support full claim structures
including nested hashes and arrays.

Both use the standard Koha secret (database password) for signing,
reusing the existing _add_default_jwt_params internal function.

This will be used by the upcoming Koha::Module::Policy classes, which
will serialize per-module capability hashes as JWTs in API response
headers.

Test plan:
1. Apply patch
2. Run:
   $ ktd --shell
   k$ prove t/Koha/Token.t
=> SUCCESS: Tests pass
3. Tests cover:
   - Simple hashref encoding/decoding (string, numeric, boolean)
   - Complex nested structures (hashes, arrays)
   - JWT format validation
4. Sign off :-D

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to