mirror of
https://github.com/elyby/accounts.git
synced 2025-05-31 14:11:46 +05:30
Объединены сущности для авторизации посредством JWT токенов и токенов, выданных через oAuth2.
Все действия, связанные с аккаунтами, теперь вызываются через url `/api/v1/accounts/<id>/<action>`. Добавлена вменяемая система разграничения прав на основе RBAC. Теперь oAuth2 токены генерируются как случайная строка в 40 символов длинной, а не UUID. Исправлен баг с неправильным временем жизни токена в ответе успешного запроса аутентификации. Теперь все unit тесты можно успешно прогнать без наличия интернета.
This commit is contained in:
@@ -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([
|
||||
|
||||
Reference in New Issue
Block a user