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:
@@ -8,24 +8,29 @@ use yii\codeception\BasePage;
|
||||
*/
|
||||
class TwoFactorAuthRoute extends BasePage {
|
||||
|
||||
public $route = '/two-factor-auth';
|
||||
|
||||
public function credentials() {
|
||||
public function credentials(int $accountId) {
|
||||
$this->setRoute($accountId);
|
||||
$this->actor->sendGET($this->getUrl());
|
||||
}
|
||||
|
||||
public function enable($totp = null, $password = null) {
|
||||
public function enable(int $accountId, $totp = null, $password = null) {
|
||||
$this->setRoute($accountId);
|
||||
$this->actor->sendPOST($this->getUrl(), [
|
||||
'totp' => $totp,
|
||||
'password' => $password,
|
||||
]);
|
||||
}
|
||||
|
||||
public function disable($totp = null, $password = null) {
|
||||
public function disable(int $accountId, $totp = null, $password = null) {
|
||||
$this->setRoute($accountId);
|
||||
$this->actor->sendDELETE($this->getUrl(), [
|
||||
'totp' => $totp,
|
||||
'password' => $password,
|
||||
]);
|
||||
}
|
||||
|
||||
private function setRoute(int $accountId) {
|
||||
$this->route = "/v1/accounts/{$accountId}/two-factor-auth";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user