private function checkRequestAndClient(ServerRequestInterface $request, ClientInterface $client) { Assertion::true($this->isRequestSecured($request), 'The request must be secured.'); Assertion::true($client->has('registration_access_token'), 'Invalid client.'); $values = []; $token = $this->bearer_token->findToken($request, $values); Assertion::notNull($token, 'Initial Access Token is missing or invalid.'); Assertion::eq($token, $client->get('registration_access_token'), 'Initial Access Token is missing or invalid.'); }
/** * @param \Psr\Http\Message\ServerRequestInterface $request * * @throws \InvalidArgumentException * * @return \OAuth2\Endpoint\ClientRegistration\InitialAccessTokenInterface|null */ private function findInitialAccessToken(ServerRequestInterface $request) { if (false === $this->isInitialAccessTokenSupported()) { return; } $values = []; $token = $this->bearer_token->findToken($request, $values); if (true === $this->isInitialAccessTokenRequired()) { Assertion::notNull($token, 'Initial Access Token is missing or invalid.'); } if (null === $token) { return; } $initial_access_token = $this->initial_access_token_manager->getInitialAccessToken($token); Assertion::notNull($initial_access_token, 'Initial Access Token is missing or invalid.'); Assertion::false($initial_access_token->hasExpired(), 'Initial Access Token expired.'); return $initial_access_token; }