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