Koha-clms/Koha/REST
Tomás Cohen Arazi 44cc4b367e
Bug 42719: [26.05.x] Handle missing CGISESSID in OAuth login (IdP-initiated flow)
When a user initiates login from the IdP (e.g. Okta app tile), they
hit the OAuth endpoint without an existing session cookie. The code
crashed calling ->value on an undefined cookie object.

This patch:
- Removes the premature 'No user session found' guard that blocked
  IdP-initiated flows entirely
- Creates a session on-the-fly for the initial request when no
  cookie exists (IdP-initiated flow)
- On callback, redirects with wrong_csrf_token error instead of
  crashing when the cookie is missing

CSRF protection is preserved: the state token is bound to the
session created in the initial request, and the browser returns
the cookie on callback for validation.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit cd02922675f42f1c404acaa274d14fd155778941)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
2026-09-25 09:42:15 -06:00
..
Plugin Bug 37711: Add support for staff interface auto-register on IdP 2025-11-05 07:12:32 -07:00
V1 Bug 42719: [26.05.x] Handle missing CGISESSID in OAuth login (IdP-initiated flow) 2026-09-25 09:42:15 -06:00
V1.pm Bug 37762: Send message back to requesting agency 2026-05-08 12:25:46 -06:00