aboutsummaryrefslogtreecommitdiff
path: root/Psso/AuthProvider/ConfigFile.php
blob: 0d855d04389b39753a8323659d2feca9515abf5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
    }
}