code: def verify_request_common(consumers, url, method, headers, params):
      
      log.debug("consumers %s", consumers)
      log.debug("url %s", url)
      log.debug("method %s", method)
      log.debug("headers %s", headers)
      log.debug("params %s", params)
  
      oauth_server = LTIOAuthServer(consumers)
      oauth_server.add_signature_method(
          SignatureMethod_PLAINTEXT_Unicode())
      oauth_server.add_signature_method(
          SignatureMethod_HMAC_SHA1_Unicode())
  
      # Check header for SSL before selecting the url
      if headers.get('X-Forwarded-Proto', 'http') == 'https':
          url = url.replace('http:', 'https:', 1)
  
      oauth_request = Request_Fix_Duplicate.from_request(
          method,
          url,
          headers=dict(headers),
          parameters=params
      )
      if not oauth_request:
          log.info('Received non oauth request on oauth protected page')
          raise LTIException('This page requires a valid oauth session '
                             'or request')
      try:
          # pylint: disable=protected-access
          oauth_consumer_key = oauth_request.get_parameter('oauth_consumer_key')
          consumer = oauth_server.lookup_consumer(oauth_consumer_key)
          if not consumer:
              raise oauth2.Error('Invalid consumer.')
          oauth_server.verify_request(oauth_request, consumer, None)
      except oauth2.Error:
          # Rethrow our own for nice error handling (don't print
          # error message as it will contain the key
          raise LTIException("OAuth error: Please check your key and secret")
  
      return True
docs: Verifies that request is valid
  
      :param consumers: consumers from config file
      :param url: request url
      :param method: request method
      :param headers: request headers
      :param params: request params
      :return: is request valid