@param Token $token
@param VerificationContext|null $verificationContext

@throws VerifyTokenException
327551
public function verify(Token $token, VerificationContext $verificationContext = null): void
    {
        if (null === $verificationContext) {
            $verificationContext = new VerificationContext($this->getEncryption());
        }

        if ($this->getAudience()) {
            $verificationContext->setAudience($this->getAudience());
        }

        try {
            $this->getLib()->verify($token, $verificationContext);
        } catch (\Exception $exception) {
            throw new VerifyTokenException('Token did not pass the verification', $exception->getCode(), $exception);
        }
    }
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;
    }
796879
public function invalidateBearerToken(BearerToken $token)
    {
        $request = $this->createRequest('/oauth2/invalidate_token');
        $request->setPostParameter('access_token', $token->getValue());
        $this->signRequest($request, new BasicToken());

        $response = $this->sendRequest($request);

        if ($token->getValue() !== $response->getData('access_token')) {
            throw new OAuthException('An error occured when invalidating the bearer token.', $response);
        }
    }
892873
public function authenticate(TokenInterface $token = null)
    {
        // If no token is passed in, try and find one from the authenticator
        $token = $token ?: $this->authenticator->present();

        if ( ! $token instanceof TokenInterface) {
            return new Result(Result::FAILURE_NO_TOKEN);
        }

        $result = new Result();

        try {
            $token = $this->authenticator->authenticate($token);
        } catch (AuthenticationException $e) {
            $result->setCode($e->getCode());
            $result->setException($e);
            $result->setToken($e->getToken());

            return $result;
        }

        $result->setCode(Result::SUCCESS);
        $result->setToken($token);

        if ( ! $token instanceof StatelessTokenInterface) {
            $this->storage->write($token);
        }

        $this->setToken($token);

        return $result;
    }
1126704
public function authenticate($token, $authMethod = null)
    {
        if ($token === null) {
            throw InvalidArgumentException('You need to specify a token');
        }

        if ($authMethod === null) {
            $authMethod = self::AUTH_URL_TOKEN;
        }

        $this->getHttpClient()->authenticate($token, $authMethod);
    }
1224005
public static function verify($token, $key)
    {
        // Check values
        if (empty($token) || empty($key)) {
            return false;
        }

        // Split parts
        list($payloadJSON_encoded, $signature) = explode('.', $token);

        // Generate signature to verify
        $signatureGenerated = hash_hmac('SHA256', $payloadJSON_encoded, $key);

        return ($signature === $signatureGenerated);
    }
608062
protected function doExecute(AssertionContext $context)
    {
        $profileContext = $context->getProfileContext();
        $trustOptions = $profileContext->getTrustOptions();
        if (false === $trustOptions->getEncryptAssertions()) {
            return;
        }

        if (null == $assertion = $context->getAssertion()) {
            throw new LightSamlContextException($context, 'Assertion for encryption is not set');
        }
        $context->setAssertion(null);

        $query = $this->credentialResolver->query();
        $query
            ->add(new EntityIdCriteria($profileContext->getPartyEntityDescriptor()->getEntityID()))
            ->add(new MetadataCriteria(
                ProfileContext::ROLE_IDP === $profileContext->getOwnRole()
                ? MetadataCriteria::TYPE_SP
                : MetadataCriteria::TYPE_IDP,
                SamlConstants::PROTOCOL_SAML2
            ))
            ->add(new UsageCriteria(UsageType::ENCRYPTION))
        ;
        $query->resolve();

        /** @var CredentialInterface $credential */
        $credential = $query->firstCredential();
        if (null == $credential) {
            throw new LightSamlContextException($context, 'Unable to resolve encrypting credential');
        }
        if (null == $credential->getPublicKey()) {
            throw new LightSamlContextException($context, 'Credential resolved for assertion encryption does not have a public key');
        }

        $encryptedAssertionWriter = new EncryptedAssertionWriter(
            $trustOptions->getBlockEncryptionAlgorithm(),
            $trustOptions->getKeyTransportEncryptionAlgorithm()
        );
        $encryptedAssertionWriter->encrypt($assertion, $credential->getPublicKey());

        $context->setEncryptedAssertion($encryptedAssertionWriter);
    }
730502
public function verify($token, $data=null)
    {
        $form_name = $this->getDefaultFormName();
        $token || $token = isset($_POST[$form_name]) ? $_POST[$form_name] : (isset($_GET[$form_name]) ? $_GET[$form_name] : null);
        
        if (!$token) {
            return ErrorInfo::error('需要 form_token 参数');
        }
        
        return parent::verify($token, $data);
    }
887376
public static function verify($token)
  {
    $userToken = Password::where('token', $token)->first();

    if ($userToken == null) {
      return false;
    }

    if ($userToken->created_at->diffInMinutes() <= config('app.reset_token.expire')) {
      if (Session::has('token')) {
        if (Session::key('token') == $userToken->token) {
          return true;
        }
        else {
          Session::delete('token');
          return false;
        }
      }
      else {
        return false;
      }
    }

    $userToken->delete();
    return false;
  }
1313472
public function scopeValidOrFail($query, string $token)
    {
        /** @var RegistrationToken $token */
        $token = $query->find($token);

        if (! $token || $token->created_at->lessThan(Carbon::now()->subDay())) {
            throw new InvalidConfirmationTokenException;
        }

        return $token;
    }
125662
public static Map<String, Object> verify(String token, final RSAPublicKey pk) throws InvalidTokenException {
        // RS256签名验证器
        Verifier verifier = new Verifier() {
            @Override
            public boolean verifySignature(String content, String payload, String signature) {
                return JWT.verifySignature(content,signature,pk);
            }
        };
        return verify(token, verifier);
    }
1008851
public function load(string $token, JWKSet $encryptionKeySet, JWKSet $signatureKeySet, ?int &$signature = null): JWS
    {
        $recipient = null;
        $jwe = $this->jweLoader->loadAndDecryptWithKeySet($token, $encryptionKeySet, $recipient);
        $this->checkContentTypeHeader($jwe, $recipient);
        if (null === $jwe->getPayload()) {
            throw new \InvalidArgumentException('The token has no payload.');
        }

        return $this->jwsLoader->loadAndVerifyWithKeySet($jwe->getPayload(), $signatureKeySet, $signature);
    }
542521
protected function doAuth($provider, TokenInterface $token)
    {
        if (! $provider instanceof ApiKeyUserProviderInterface) {
            return false;
        }

        /** @var UserInterface $user */
        $user = $provider->loadUserByApiKey($token->getCredentials());

        if ($user) {
            $authenticatedToken = new ApiKeyUserToken($user->getRoles());
            $authenticatedToken->setUser($user);

            return $authenticatedToken;
        }

        throw new AuthenticationException("The API Key authentication failed.");
    }
1028560
public function verify($token, $identifier = null)
    {
        $identifier = ($identifier !== null) ? $identifier : $this->identifier;

        // Throw error for empty token or empty message id, because the server will not handle this
        if (empty($token)) {
            throw new Totp\EmptyTokenException();
        }
        if (empty($this->identifier)) {
            throw new Totp\EmptyIdentifierException();
        }

        try {
            $this->sendApiCall(self::ACTION_RETRIEVE, sprintf('totp/%s?token=%s', $identifier, $token));
        } catch (Exception $e) {
            if (Totp\Exception::isTotpException($e)) {
                throw new Totp\Exception($e);
            } else {
                throw $e;
            }
        }
    }
1122784
public function verify($token)
    {
        try {
            $this->client()->head('authentication-tokens/{token}', ['token' => $token]);

            return true;
        } catch (NotFoundException $e) {
            return false;
        }
    }
1024993
public function getToken(TokenContext $context)
    {
        $identity = empty($context->getIdentity()) ? $this->getDefaultIdentity() : $context->getIdentity();
        return $this->jwtGenerator->generateToken($identity, $this->additionalData);
    }
287960
public function verify(string $token, string $provider, string $musked)
  {
    $userToken = VerifiedUser::where('token', $token)->first();

    if ($userToken == null) return false;
    $userEmail = $userToken->email;

    $model = config("auth.provider.{$provider}.model")::where($musked, $userEmail)->first();

    if ($model == null) return false;

    $userToken->delete();

    $model->update([
      'email_verified_at' => Carbon::now()
    ]);

    return $model;
  }