런처 관리자 증표 응답 제거
This commit is contained in:
1 parent
6f17b15f4b
commit
71731245de
1 file changed
-14
@@ -27,19 +27,6 @@ function launcher_is_digit_password(string $password): bool
|
|||||||
return preg_match('/^\d{4}$/', $password) === 1;
|
return preg_match('/^\d{4}$/', $password) === 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function launcher_admin_assertion(array $config): string
|
|
||||||
{
|
|
||||||
$body = base64_encode(json_encode([
|
|
||||||
'aud' => 'car-monitor',
|
|
||||||
'admin' => true,
|
|
||||||
'iat' => time(),
|
|
||||||
'exp' => time() + 120,
|
|
||||||
], JSON_UNESCAPED_SLASHES));
|
|
||||||
$sig = hash_hmac('sha256', $body, (string)($config['auth']['secret'] ?? ''));
|
|
||||||
|
|
||||||
return $body . '.' . $sig;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||||
$data = custom_read_request_data();
|
$data = custom_read_request_data();
|
||||||
$action = $data['action'] ?? 'login';
|
$action = $data['action'] ?? 'login';
|
||||||
@@ -130,7 +117,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
|
|||||||
custom_json([
|
custom_json([
|
||||||
'admin' => $isAdmin,
|
'admin' => $isAdmin,
|
||||||
'authenticated' => $isAdmin,
|
'authenticated' => $isAdmin,
|
||||||
'assertion' => $isAdmin ? launcher_admin_assertion($config) : '',
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user