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

--- Comment #26 from Jonathan Druart <[email protected]> ---
Created attachment 200639
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=200639&action=edit
Bug 36369: (follow-up) Move CSRF token handling from HttpClient to
KohaApiClient

HttpClient is a generic HTTP utility with no knowledge of Koha.
CSRF tokens are a Koha API concern: generated server-side by
Koha::Token->generate_csrf() and embedded in the page's meta tag.

This patch moves CSRF responsibility to the correct layer:
- KohaApiClient._readCsrfToken() reads the token from the DOM
- KohaApiClient._withCsrf() injects the CSRF-TOKEN header into
  state-changing requests (post, put, patch, delete)
- HttpClient no longer has any CSRF awareness

This makes HttpClient reusable as a generic fetch wrapper, and
keeps Koha-specific API semantics (embed, CSRF) centralized in
KohaApiClient.

Signed-off-by: Tomas Cohen Arazi <[email protected]>

Signed-off-by: Jonathan Druart <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to