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