Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Add additional signature mismatch test
Browse files Browse the repository at this point in the history
  • Loading branch information
Firehed committed Oct 27, 2021
1 parent d09d994 commit 80874ad
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/ServerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,19 @@ public function testValidateLoginThrowsIfSignatureIsInvalid(): void
$this->server->validateLogin($challenge, $response, [$registration]);
}

public function testValidateLoginThrowsIfWrongDataIsSigned(): void
{
$challenge = $this->getDefaultLoginChallenge();
$response = $this->getDefaultLoginResponse([
'getSignedData' => 'some other signed data',
]);
$registration = $this->getDefaultRegistration();

$this->expectException(SecurityException::class);
$this->expectExceptionCode(SecurityException::SIGNATURE_INVALID);
$this->server->validateLogin($challenge, $response, [$registration]);
}

/**
* Arguably the most important authentication test: ensure that
* a perfectly-valid signature is rejected if it's not actually from the
Expand Down

0 comments on commit 80874ad

Please sign in to comment.