bericht/api/verify.php
Eddy 960cee4be4
All checks were successful
Deploy bericht / deploy (push) Successful in 14s
Bericht-API: SSO-Migration auf awlauth (JWT -> awl_sso-Cookie)
- _inc.php: api_authenticate() nutzt awlauth_require(bericht,read) inkl.
  same-origin-CSRF; CORS (Access-Control-Allow-Origin:*) entfernt (mit
  Cookies unzulaessig + bei same-origin ueberfluessig).
- auth.php: Login ueber awlauth_login/issue -> HttpOnly-Cookie awl_sso,
  kein Token mehr im Body.
- photo.php/pdf.php: GET-Binaer ueber awlauth_verify (kein CSRF, da auch
  per window.location/<object> geladen); Bearer/jwt-Query-Auth entfernt.
- shipments.php: unveraendert (nutzt api_authenticate -> awlauth_require).
- neu: logout.php (Single-Logout), verify.php (sliding session).
- _jwt.php geloescht (JWT vollstaendig abgeloest).

[deploy]
2026-07-06 15:24:42 +02:00

25 lines
772 B
PHP

<?php
/* GET /api/verify.php — prüft das awl_sso-Cookie und erneuert die Session (sliding).
* Ersatz für die frühere lokale Token-Prüfung (ensureAuth) im Frontend.
* Bewusst awlauth_verify (ohne CSRF) — reiner Lese-/Renew-Aufruf.
*/
require_once __DIR__.'/_inc.php';
if (!dol_include_once('/awlauth/lib/awlauth.lib.php') || !function_exists('awlauth_verify')) {
api_fail('SSO-Modul (awlauth) nicht verfügbar', 500);
}
$u = awlauth_verify();
if (!$u || !$u->hasRight('bericht', 'read')) {
api_fail('Nicht angemeldet', 401);
}
awlauth_issue($u); // gleitende Verlängerung der Gültigkeit
api_ok(array(
'user' => array(
'id' => (int) $u->id,
'login' => $u->login,
'name' => $u->getFullName($langs ?? null),
),
));