summaryrefslogtreecommitdiff
path: root/static/api/whoami.php
blob: f32cd2c2d98eb03281a183991bcc4f7aab9b8b48 (plain)
1
2
3
4
5
6
7
8
9
10
11
<?php
// Return current authenticated user from nginx
header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Credentials: true');

// nginx에서 전달된 사용자 정보 읽기 (X-Auth-User 헤더 또는 REMOTE_USER)
$user = $_SERVER['HTTP_X_AUTH_USER'] ?? $_SERVER['REMOTE_USER'] ?? '';

echo json_encode(['user' => $user]);
?>