From 3354d45762bbe0db33e3d26d8997e6f6624f24d7 Mon Sep 17 00:00:00 2001 From: winter Sparkles Date: Sun, 9 Aug 2026 02:26:33 +0100 Subject: implement sessions and also log in/out session data is stored in sqlite, not using php sessions --- Psso/AuthProvider/ConfigFile.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'Psso/AuthProvider') diff --git a/Psso/AuthProvider/ConfigFile.php b/Psso/AuthProvider/ConfigFile.php index 0d855d0..688c193 100644 --- a/Psso/AuthProvider/ConfigFile.php +++ b/Psso/AuthProvider/ConfigFile.php @@ -2,15 +2,20 @@ namespace Psso\AuthProvider; use Psso\{AuthProvider, AuthInterface}; -class ConfigFile extends AuthProvider implements AuthInterface\Password { +class ConfigFile extends AuthProvider +implements AuthInterface\Password, AuthInterface\UserExists { public function validatePassword( string $username, #[\SensitiveParameter] string $password ): bool { - $hash = $this->config['users']["$username.password-hash"] ?? null; + $hash = $this->config['users'][$username]['password-hash'] ?? null; if (!isset($hash)) { return false; } return password_verify($password, $hash); } + + public function userExists(string $username): bool { + return isset($this->config['users'][$username]); + } } -- cgit v1.3