From 4fdd6ddfddb1b04e084addba7fb68c1ed1b87646 Mon Sep 17 00:00:00 2001 From: Fenris Wolf Date: Mon, 22 Sep 2025 20:48:38 +0200 Subject: [PATCH] [del] trash --- trash/callbacks.php | 90 --------------------------------------------- 1 file changed, 90 deletions(-) delete mode 100644 trash/callbacks.php diff --git a/trash/callbacks.php b/trash/callbacks.php deleted file mode 100644 index e82632c..0000000 --- a/trash/callbacks.php +++ /dev/null @@ -1,90 +0,0 @@ - 2, - 'auth_secret' => 'foobar', - 'usersfile_path' => '/var/authelia/users.yaml', - ]; - - $http_request = \alveolata\cgi\get_http_request(); - $data = \alveolata\json\decode($http_request->body); - $http_response = null; - - $action = 'set_users'; - - switch ($action) { - case 'set_users': { - $timestamp_local = time(); - $timestamp_remote = $data['timestamp']; - if (\abs($timestamp_local - $timestamp_remote) > $conf['timestamp_tolerance']) { - $http_response = new \alveolata\http\struct_response( - 403, - [], - 'forbidden:timestamp' - ); - } - else { - $authhash_is = $data['authhash']; - $authhash_shall = \hash( - 'sha256', - ($data['timestamp_remote'] . $conf['auth_secret']) - ); - if ($authhash_is !== $authhash_shall) { - $http_response = new \alveolata\http\struct_response( - 403, - [], - 'forbidden:authhash' - ); - } - else { - \alveolata\file\write( - $conf['usersfile_path'], - yaml_encode($data['data']) - ); - $http_response = new \alveolata\http\struct_response( - 200, - [], - 'ok' - ); - } - } - break; - } - default: { - $http_response = new \alveolata\http\struct_response( - 501, - [], - 'not_implemented' - ); - } - } - \alveolata\cgi\put_http_response($http_response); -} - - -\alveolata\cgi\setup(); -main(); -