Fix for ARGON2 passwords, they shouldnt be base64 encoded. Fixes #316
This commit is contained in:
parent
75dbb37d8b
commit
f8d7819153
@ -10,16 +10,16 @@ final class Argon2i extends Base
|
|||||||
|
|
||||||
public static function subid(string $password): bool
|
public static function subid(string $password): bool
|
||||||
{
|
{
|
||||||
return str_starts_with(base64_decode(self::password($password)),self::identifier.'$');
|
return str_starts_with(self::password($password),self::identifier.'$');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function compare(string $source,string $compare): bool
|
public function compare(string $source,string $compare): bool
|
||||||
{
|
{
|
||||||
return password_verify($compare,base64_decode($this->password($source)));
|
return password_verify($compare,$this->password($source));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function encode(string $password): string
|
public function encode(string $password): string
|
||||||
{
|
{
|
||||||
return sprintf('{%s}%s',self::key,base64_encode(password_hash($password,PASSWORD_ARGON2I)));
|
return sprintf('{%s}%s',self::key,password_hash($password,PASSWORD_ARGON2I));
|
||||||
}
|
}
|
||||||
}
|
}
|
4
tests/server/openldap/schema/modify/99-argon.ldif
Normal file
4
tests/server/openldap/schema/modify/99-argon.ldif
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
dn: cn=z-module{0},cn=config
|
||||||
|
changetype: modify
|
||||||
|
add: olcModuleLoad
|
||||||
|
olcModuleLoad: argon2
|
Loading…
x
Reference in New Issue
Block a user