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;
|
2019-12-04 23:40:15 +05:30
|
|
|
use api\modules\authserver\validators\AccessTokenValidator;
|
2016-08-21 04:51:39 +05:30
|
|
|
use api\modules\authserver\validators\RequiredValidator;
|
|
|
|
|
2017-05-31 05:40:22 +05:30
|
|
|
class ValidateForm 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;
|
|
|
|
|
2019-12-04 23:40:15 +05:30
|
|
|
public function rules(): array {
|
2016-08-21 04:51:39 +05:30
|
|
|
return [
|
|
|
|
[['accessToken'], RequiredValidator::class],
|
2019-12-04 23:40:15 +05:30
|
|
|
[['accessToken'], AccessTokenValidator::class],
|
2016-08-21 04:51:39 +05:30
|
|
|
];
|
|
|
|
}
|
|
|
|
|
2019-12-04 23:40:15 +05:30
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
* @throws \api\modules\authserver\exceptions\ForbiddenOperationException
|
|
|
|
* @throws \api\modules\authserver\exceptions\IllegalArgumentException
|
|
|
|
*/
|
2018-04-18 02:17:25 +05:30
|
|
|
public function validateToken(): bool {
|
2019-12-04 23:40:15 +05:30
|
|
|
return $this->validate();
|
2016-08-21 04:51:39 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
}
|