Token verification.

@param string $token

@return bool
347519
protected function verifyToken(string $token): bool
    {
        if ($this->token_validation_url) {
            $this->logger->debug('validate oauth2 token via rfc7662 token validation endpoint ['.$this->token_validation_url.']', [
               'category' => get_class($this),
            ]);

            $url = str_replace('{token}', $token, $this->token_validation_url);
        } else {
            $discovery = $this->getDiscoveryDocument();
            if (!(isset($discovery['userinfo_endpoint']))) {
                throw new OidcException\UserEndpointNotSet('userinfo_endpoint could not be determained');
            }

            $this->logger->debug('validate token via openid-connect userinfo_endpoint ['.$discovery['userinfo_endpoint'].']', [
               'category' => get_class($this),
            ]);

            $url = $discovery['userinfo_endpoint'].'?access_token='.$token;
        }

        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        $result = curl_exec($ch);
        $code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
        curl_close($ch);
        $response = json_decode($result, true);

        if (200 === $code) {
            $attributes = json_decode($result, true);
            $this->logger->debug('successfully verified oauth2 access token via authorization server', [
               'category' => get_class($this),
            ]);

            if (!isset($attributes[$this->identity_attribute])) {
                throw new Exception\IdentityAttributeNotFound('identity attribute '.$this->identity_attribute.' not found in oauth2 response');
            }

            $this->identifier = $attributes[$this->identity_attribute];

            if ($this->token_validation_url) {
                $this->attributes = $attributes;
            } else {
                $this->access_token = $token;
            }

            return true;
        }
        $this->logger->error('failed verify oauth2 access token via authorization server, received status ['.$code.']', [
               'category' => get_class($this),
            ]);

        throw new OidcException\InvalidAccessToken('failed verify oauth2 access token via authorization server');
    }
685416
public function isSameAs(Token $token)
    {
        $hasNumberWildcard = ($this->hasNumber() && $token->hasNumber());
        if ($hasNumberWildcard && $this->number !== $token->number) {
            return false;
        }
        $hasValueWildcard = ($this->hasValue() && $token->hasValue());
        if ($hasValueWildcard && $this->value !== $token->value) {
            return false;
        }
        $hasLineNumberWildcard = ($this->hasLineNumber() && $token->hasLineNumber());
        if ($hasLineNumberWildcard && $this->lineNumber !== $token->lineNumber) {
            return false;
        }

        return true;
    }
175361
public function exists($token)
    {
        $reset = PasswordReset::where('token', $token)->first();
        return $reset and ! $reset->isExpired();
    }
906483
protected function checkToken($token)
    {
        if (!$token) {
            return false;
        }

        $file = $this->pathForToken($token);
        $content = null;

        if (file_exists($file)) {
            $content = file_get_contents($file);
            unlink($file);
        }

        return $content === $token;
    }
1249760
protected function contains($token)
    {
        return stripos($this->whois, sprintf($token, $this->domain)) !== false;
    }
909826
protected function validateTagToken(TagToken $token) : bool
    {
        $tagName = $token->getTagName();
        $tagDef = $this->tagDefs->get($tagName);
        if (!isset($tagDef)) {
            return false;
        }

        return $tagDef->validate($token);
    }
1198479
private function _checkProhibitedTokens($token) {
		if ($this->_isActive('checkProhibitedTokens')) {
			if (in_array($token->getName(), $this->_prohibitedTokens)) {
				$msg = $this->_getMessage("PROHIBITED_TOKEN", $token->getName());
				$this->_writeError('checkProhibitedTokens', $msg);
			}
		}
	}
834460
public static function verify($token, $strict = false)
    {

        if (!Session::getInstance()->has('__bow.csrf')) {
            return false;
        }

        $csrf = Session::getInstance()->get('__bow.csrf');

        if ($token !== $csrf['token']) {
            return false;
        }

        $status = true;

        if ($strict) {
            $status = $status && static::CsrfExpirated(time());
        }

        return $status;
    }
1355155
public function verifyChallenge(string $token) : VerifyChallengeResponse
    {
        $request = new VerifyChallenge($token);
        return $this->service->execute($request, $this->position);
    }
1373854
public function userFromToken(string $token)
    {
        $user = $this->mapUserToObject($this->getUserByToken($token));
        return $user->setToken($token);
    }
344545
public function verify(TokenInterface $token): bool
    {
        $signer = $this->factory->create($token->algorithm());
        $key    = new Key($this->verifyKey->content(), $this->verifyKey->passphrase());

        return $signer->verify($token->signature(), $token->payload(), $key);
    }
482266
protected function isTokenExpired($token)
    {
        return !$token ||
            (
                $token->getCreationTtl() > 0 &&
                time() > $token->getCreationTime() + $token->getCreationTtl()
            );
    }
875581
public function isValid($token)
    {
        try {
            $publicKey = openssl_pkey_get_public(file_get_contents($this->projectDir . '/var/jwt/public.pem'));

            $jws = SimpleJWS::load($token);

            return $jws->verify($publicKey, self::ALG) && $this->isTokenNotExpired($token);
        } catch (\InvalidArgumentException $ex) {
            return false;
        }
    }
144953
public static function isPasswordResetTokenValid($token)
    {
        if (empty($token)) {
            return false;
        }
        $timestamp = (int)substr($token, strrpos($token, '_') + 1);
        $expire = UsersModule::module()->passwordResetTokenExpire;
        return $timestamp + $expire >= time();
    }
1341516
public static function isClause($token)
    {
        if (($token->type === Token::TYPE_KEYWORD && isset(Parser::$STATEMENT_PARSERS[$token->keyword]))
            || ($token->type === Token::TYPE_NONE && strtoupper($token->token) === 'DELIMITER')
        ) {
            return 2;
        } elseif ($token->type === Token::TYPE_KEYWORD && isset(Parser::$KEYWORD_PARSERS[$token->keyword])
        ) {
            return 1;
        }

        return false;
    }
54657
public function verify($token = null)
    {
        $token = isset($token)
            ? $token
            : input()->postGet('csrf-token');

        if (is_string($token)) {
            return hash_equals($this->getToken(), $token);
        }

        return false;
    }
326096
public function verify($token)
    {
        $result = $this->find('token', compact('token'))->firstOrFail();

        $event = $this->dispatchEvent('Muffin/Tokenize.beforeVerify', ['token' => $result]);
        if ($event->isStopped()) {
            return false;
        }

        if (!empty($result['foreign_data'])) {
            $table = $this->foreignTable($result);
            $fields = $result['foreign_data'];
            $conditions = [(string)$table->getPrimaryKey() => $result['foreign_key']];
            $table->updateAll($fields, $conditions);
        }

        $result->set('status', true);
        $this->save($result);

        $this->dispatchEvent('Muffin/Tokenize.afterVerify', ['token' => $result]);

        return $result;
    }