Объединены сущности для авторизации посредством JWT токенов и токенов, выданных через oAuth2.

Все действия, связанные с аккаунтами, теперь вызываются через url `/api/v1/accounts/<id>/<action>`.
Добавлена вменяемая система разграничения прав на основе RBAC.
Теперь oAuth2 токены генерируются как случайная строка в 40 символов длинной, а не UUID.
Исправлен баг с неправильным временем жизни токена в ответе успешного запроса аутентификации.
Теперь все unit тесты можно успешно прогнать без наличия интернета.
This commit is contained in:
ErickSkrauch
2017-09-19 20:06:16 +03:00
parent 928b3aa7fc
commit dd2c4bc413
173 changed files with 2719 additions and 2748 deletions

View File

@@ -17,9 +17,9 @@ class TwoFactorAuthEnableCest {
}
public function testFails(FunctionalTester $I) {
$I->amAuthenticated('AccountWithOtpSecret');
$accountId = $I->amAuthenticated('AccountWithOtpSecret');
$this->route->enable();
$this->route->enable($accountId);
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@@ -28,7 +28,7 @@ class TwoFactorAuthEnableCest {
],
]);
$this->route->enable('123456', 'invalid_password');
$this->route->enable($accountId, '123456', 'invalid_password');
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@@ -37,8 +37,8 @@ class TwoFactorAuthEnableCest {
],
]);
$I->amAuthenticated('AccountWithEnabledOtp');
$this->route->enable('123456', 'invalid_password');
$accountId = $I->amAuthenticated('AccountWithEnabledOtp');
$this->route->enable($accountId, '123456', 'invalid_password');
$I->canSeeResponseContainsJson([
'success' => false,
'errors' => [
@@ -48,9 +48,9 @@ class TwoFactorAuthEnableCest {
}
public function testSuccessEnable(FunctionalTester $I) {
$I->amAuthenticated('AccountWithOtpSecret');
$accountId = $I->amAuthenticated('AccountWithOtpSecret');
$totp = TOTP::create('AAAA');
$this->route->enable($totp->now(), 'password_0');
$this->route->enable($accountId, $totp->now(), 'password_0');
$I->canSeeResponseCodeIs(200);
$I->canSeeResponseIsJson();
$I->canSeeResponseContainsJson([