Skip to content

Commit

Permalink
test 5
Browse files Browse the repository at this point in the history
  • Loading branch information
drylian committed Dec 7, 2023
1 parent 8eb0d56 commit 2949043
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
use Pterodactyl\Models\Server;
use Pterodactyl\Models\Permission;
use Pterodactyl\Models\UserSSHKey;
use phpseclib3\Crypt\EC\PrivateKey;
use phpseclib3\Crypt\EC;
use Pterodactyl\Tests\Integration\IntegrationTestCase;

class SftpAuthenticationControllerTest extends IntegrationTestCase
Expand Down Expand Up @@ -108,11 +108,6 @@ public function testUserIsThrottledIfInvalidCredentialsAreProvided()
->assertStatus($i === 10 ? 429 : 403);
}
}
// test
private static function createKeys()
{
return PrivateKey::createKey('Ed25519')->getPublicKey()->toString('OpenSSH');
}
/**
* Test that the user is not throttled so long as a valid public key is provided, even
* if it doesn't actually exist in the database for the user.
Expand All @@ -123,7 +118,7 @@ public function testUserIsNotThrottledIfNoPublicKeyMatches()
$this->postJson('/api/remote/sftp/auth', [
'type' => 'public_key',
'username' => $this->getUsername(),
'password' => $this->createKeys(),
'password' => EC::createKey('Ed25519')->getPublicKey()->toString('OpenSSH');,
])
->assertForbidden();
}
Expand Down

0 comments on commit 2949043

Please sign in to comment.