mirror of
https://github.com/elyby/accounts.git
synced 2024-12-05 04:58:56 +05:30
26 lines
665 B
PHP
26 lines
665 B
PHP
<?php
|
|
namespace api\modules\authserver\validators;
|
|
|
|
use api\modules\authserver\exceptions\IllegalArgumentException;
|
|
|
|
/**
|
|
* The maximum length of clientToken for our database is 255.
|
|
* If the token is longer, we do not accept the passed token at all.
|
|
*/
|
|
class ClientTokenValidator extends \yii\validators\RequiredValidator {
|
|
|
|
/**
|
|
* @param string $value
|
|
* @return null
|
|
* @throws \api\modules\authserver\exceptions\AuthserverException
|
|
*/
|
|
protected function validateValue($value) {
|
|
if (mb_strlen($value) > 255) {
|
|
throw new IllegalArgumentException('clientToken is too long.');
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
}
|