19 declare(strict_types=1);
31 $this->assertInstanceOf(ilArgon2idPasswordEncoder::class, $encoder);
33 if (!$encoder->isSupportedByRuntime()) {
34 $this->markTestSkipped(
'Argon2id is not supported by the runtime.');
40 #[Depends('testInstanceCanBeCreated')] 45 $this->assertTrue($encoder->
isPasswordValid($encoded_password, self::PASSWORD,
''));
46 $this->assertFalse($encoder->
isPasswordValid($encoded_password, self::WRONG_PASSWORD,
''));
50 #[Depends('testInstanceCanBeCreated')] 54 $this->expectException(ilPasswordException::class);
58 #[Depends('testInstanceCanBeCreated')] 62 $this->assertFalse($encoder->
isPasswordValid(
'encoded', str_repeat(
'a', 5000),
''));
65 #[Depends('testInstanceCanBeCreated')] 68 $this->assertSame(
'argon2id', $encoder->
getName());
71 #[Depends('testInstanceCanBeCreated')] 77 #[Depends('testInstanceCanBeCreated')] 80 $raw = self::PASSWORD;
getName()
Returns a unique name/id of the concrete password encoder.
setTimeCost(int $time_cost)
testPasswordVerificationShouldFailIfTheRawPasswordExceedsTheSupportedLength(ilArgon2idPasswordEncoder $encoder)
isPasswordValid(string $encoded, string $raw, string $salt)
Checks a raw password against an encoded password.
testEncoderDoesNotRelyOnSalts(ilArgon2idPasswordEncoder $encoder)
requiresSalt()
Returns whether the encoder requires a salt.
requiresReencoding(string $encoded)
Returns whether the encoded password needs to be re-encoded.
setMemoryCost(int $memory_costs)
testExceptionIsRaisedIfThePasswordExceedsTheSupportedLengthOnEncoding(ilArgon2idPasswordEncoder $encoder)
testReencodingIsDetectedWhenNecessary(ilArgon2idPasswordEncoder $encoder)
testPasswordShouldBeCorrectlyEncodedAndVerified(ilArgon2idPasswordEncoder $encoder)
testNameShouldBeArgon2id(ilArgon2idPasswordEncoder $encoder)
const string WRONG_PASSWORD
testInstanceCanBeCreated()
encodePassword(string $raw, string $salt)
Encodes the raw password.