Replace separate minecraft access tokens with JWT

This commit is contained in:
ErickSkrauch
2019-12-04 21:10:15 +03:00
parent 060a4e960a
commit a81ef5cac2
34 changed files with 432 additions and 303 deletions

View File

@@ -14,7 +14,9 @@ class TokensFactoryTest extends TestCase {
$account = new Account();
$account->id = 1;
$token = TokensFactory::createForAccount($account);
$factory = new TokensFactory();
$token = $factory->createForWebAccount($account);
$this->assertEqualsWithDelta(time(), $token->getClaim('iat'), 1);
$this->assertEqualsWithDelta(time() + 60 * 60 * 24 * 7, $token->getClaim('exp'), 2);
$this->assertSame('ely|1', $token->getClaim('sub'));
@@ -24,7 +26,7 @@ class TokensFactoryTest extends TestCase {
$session = new AccountSession();
$session->id = 2;
$token = TokensFactory::createForAccount($account, $session);
$token = $factory->createForWebAccount($account, $session);
$this->assertEqualsWithDelta(time(), $token->getClaim('iat'), 1);
$this->assertEqualsWithDelta(time() + 3600, $token->getClaim('exp'), 2);
$this->assertSame('ely|1', $token->getClaim('sub'));