Skip to content

Commit

Permalink
misc
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed Nov 18, 2023
1 parent 725a245 commit 5634632
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions src/Auth/LunaAuthMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,11 @@ public function authenticate(array $credential): AuthResult
$M2 = BigInteger::fromBase($M2, 16);

$proof = (string) $this->srpService->getUserState();

$proof = BigInteger::fromBase($proof, 16);

$this->srpService->clearUserState();

if (!hash_equals((string) $proof, (string) $M2)) {
return new AuthResult(AuthResult::INVALID_PASSWORD, $credential);
}
Expand Down
9 changes: 7 additions & 2 deletions src/Auth/SRP/SRPService.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,14 @@ public function getUserState(): mixed
return $this->session->get(static::SESSION_KEY);
}

public function setUserState(mixed $data): mixed
public function setUserState(mixed $data): void
{
return $this->session->set(static::SESSION_KEY, $data);
$this->session->set(static::SESSION_KEY, $data);
}

public function clearUserState(): void
{
$this->session->remove(static::SESSION_KEY);
}

public function generateVerifier(string $identity, string $password): PasswordFile
Expand Down

0 comments on commit 5634632

Please sign in to comment.