19declare(strict_types=1);
32 private const string SALT =
'webdav';
49 return 'davcache_' . hash(
'sha256', $username);
60 return $this->data_signer->verify($raw, self::SALT);
63 private function writeAuthCache(
string $username,
string $password_hash,
int $usr_id): void
68 self::F_USR_ID => $usr_id,
69 self::F_USERNAME => $username,
70 self::F_PW_HASH => $password_hash,
80 if ($cached ===
null) {
84 $password = hash(
'sha256', $password);
86 if ($cached[self::F_USERNAME] === $username && $cached[self::F_PW_HASH] === $password) {
99 $password = hash(
'sha256', $password);
Key rotation can provide an extra layer of mitigation against an attacker discovering a secret key.
writeAuthCache(string $username, string $password_hash, int $usr_id)
setAuthenticated(string $username, string $password, int $user_id)
readAuthCache(string $username)
__construct(private Filesystem $filesystem, SecretKeyRotation $secret_key_rotation)
isAuthenticated(string $username, string $password)
getAuthCacheFile(string $username)
The filesystem interface provides the public interface for the Filesystem service API consumer.
if(count($parts) !=3) $payload