2016-08-21 02:21:39 +03:00
|
|
|
<?php
|
2019-12-04 21:10:15 +03:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2016-08-21 02:21:39 +03:00
|
|
|
namespace api\modules\authserver\models;
|
|
|
|
|
2017-05-31 03:10:22 +03:00
|
|
|
use api\models\base\ApiForm;
|
2016-08-21 02:21:39 +03:00
|
|
|
use api\modules\authserver\validators\RequiredValidator;
|
|
|
|
|
2017-05-31 03:10:22 +03:00
|
|
|
class InvalidateForm extends ApiForm {
|
2016-08-21 02:21:39 +03:00
|
|
|
|
2019-12-04 21:10:15 +03:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2016-08-21 02:21:39 +03:00
|
|
|
public $accessToken;
|
2018-04-17 23:47:25 +03:00
|
|
|
|
2019-12-04 21:10:15 +03:00
|
|
|
/**
|
|
|
|
* @var string
|
|
|
|
*/
|
2016-08-21 02:21:39 +03:00
|
|
|
public $clientToken;
|
|
|
|
|
2019-12-04 21:10:15 +03:00
|
|
|
public function rules(): array {
|
2016-08-21 02:21:39 +03:00
|
|
|
return [
|
|
|
|
[['accessToken', 'clientToken'], RequiredValidator::class],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
2019-12-04 21:10:15 +03:00
|
|
|
* @throws \api\modules\authserver\exceptions\IllegalArgumentException
|
2016-08-21 02:21:39 +03:00
|
|
|
*/
|
2018-04-17 23:47:25 +03:00
|
|
|
public function invalidateToken(): bool {
|
2016-08-21 02:21:39 +03:00
|
|
|
$this->validate();
|
|
|
|
|
2019-12-04 21:10:15 +03:00
|
|
|
// We're can't invalidate access token because it's not stored in our database
|
2016-08-21 02:21:39 +03:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|