/** * All-in-one function to check the signature on a request. * * Should determine the signature method appropriately * * @param JacobKiers\OAuth\Request\RequestInterface $request * @param JacobKiers\OAuth\Consumer\ConsumerInterface $consumer * @param JacobKiers\OAuth\Token\TokenInterface $token * * @throws JacobKiers\OAuth\OAuthException */ private function checkSignature(RequestInterface $request, ConsumerInterface $consumer, TokenInterface $token) { // this should probably be in a different method $timestamp = $request instanceof RequestInterface ? $request->getOAuthTimestamp() : null; $nonce = $request instanceof RequestInterface ? $request->getOAuthNonce() : null; $this->checkTimestamp($timestamp); $this->checkNonce($consumer, $token, $nonce, $timestamp); $signature_method = $this->getSignatureMethod($request); $signature = $request->getOAuthSignature(); $valid_sig = $signature_method->checkSignature($request, $consumer, $token, $signature); if (!$valid_sig) { throw new OAuthException('Invalid signature'); } }