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

@@ -10,6 +10,7 @@ use common\models\OauthClient;
use common\models\OauthSession;
use common\tests\fixtures\AccountFixture;
use common\tests\fixtures\OauthClientFixture;
use OTPHP\TOTP;
use Ramsey\Uuid\Uuid;
class AuthenticationFormTest extends TestCase {
@@ -51,6 +52,19 @@ class AuthenticationFormTest extends TestCase {
], $result['user']);
}
public function testAuthenticateByValidCredentialsWith2FA() {
$authForm = new AuthenticationForm();
$authForm->username = 'otp@gmail.com';
$authForm->password = 'password_0';
$authForm->totp = TOTP::create('BBBB')->now();
$authForm->clientToken = Uuid::uuid4()->toString();
// Just ensure that there is no exception
$this->expectNotToPerformAssertions();
$authForm->authenticate();
}
/**
* @dataProvider getInvalidCredentialsCases
*/