Add totp field for Minecraft auth protocol to login into accounts, protected with 2FA [deploy]

This commit is contained in:
ErickSkrauch
2021-03-08 11:26:47 +01:00
parent 125caa7e4e
commit 9a3534ea2b
3 changed files with 38 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ namespace api\tests\functional\authserver;
use api\tests\FunctionalTester;
use Codeception\Example;
use OTPHP\TOTP;
use Ramsey\Uuid\Uuid;
class AuthorizationCest {
@@ -91,6 +92,22 @@ class AuthorizationCest {
]);
}
public function byEmailWithEnabledTwoFactorAuthAndCorrectToken(FunctionalTester $I) {
$I->sendPOST('/api/authserver/authentication/authenticate', [
'username' => 'otp@gmail.com',
'password' => 'password_0',
'totp' => TOTP::create('BBBB')->now(),
'clientToken' => Uuid::uuid4()->toString(),
]);
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseContainsJson([
'selectedProfile' => [
'id' => '15d0afa7a2bb44d39f31964cbccc6043',
'name' => 'AccountWithEnabledOtp',
],
]);
}
public function tooLongClientToken(FunctionalTester $I) {
$I->wantTo('send non uuid clientToken with more then 255 characters length');
$I->sendPOST('/api/authserver/authentication/authenticate', [