aboutsummaryrefslogtreecommitdiff
path: root/Psso/AuthProvider/ConfigFile.php
diff options
context:
space:
mode:
Diffstat (limited to 'Psso/AuthProvider/ConfigFile.php')
-rw-r--r--Psso/AuthProvider/ConfigFile.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/Psso/AuthProvider/ConfigFile.php b/Psso/AuthProvider/ConfigFile.php
new file mode 100644
index 0000000..0d855d0
--- /dev/null
+++ b/Psso/AuthProvider/ConfigFile.php
@@ -0,0 +1,16 @@
+<?php
+namespace Psso\AuthProvider;
+use Psso\{AuthProvider, AuthInterface};
+
+class ConfigFile extends AuthProvider implements AuthInterface\Password {
+ public function validatePassword(
+ string $username,
+ #[\SensitiveParameter] string $password
+ ): bool {
+ $hash = $this->config['users']["$username.password-hash"] ?? null;
+ if (!isset($hash)) {
+ return false;
+ }
+ return password_verify($password, $hash);
+ }
+}