def validate_signed_request
      if request_parameter = request.params["signed_request"]
        encoded_signature, encoded_data = request_parameter.split(".")
        decoded_signature = base64_url_decode(encoded_signature)
        digested = OpenSSL::HMAC.digest("sha256", fb_app.secret, encoded_data)
        if valid = (digested == decoded_signature)
          Rails.logger.info "  Facebook Signed Request Valid."
        else
          Rails.logger.info "  Facebook Signed Request is not Valid. Ensure request is from Facebook and correct Facebook app has been selected."
          raise DoesFacebook::RequestSignatureInvalidError.new()
        end
      end
    end
def validate_signed_request
      if request_parameter = request.params["signed_request"]
        encoded_signature, encoded_data = request_parameter.split(".")
        decoded_signature = base64_url_decode(encoded_signature)
        digested = OpenSSL::HMAC.digest("sha256", fb_app.secret, encoded_data)
        if valid = (digested == decoded_signature)
          Rails.logger.info "  Facebook Signed Request Valid."
        else
          Rails.logger.info "  Facebook Signed Request is not Valid. Ensure request is from Facebook and correct Facebook app has been selected."
          raise DoesFacebook::RequestSignatureInvalidError.new()
        end
      end
    end
Captures a signed_request parameter and manipulates the session to allow for
 a signed_request to be passed from iframe request to iframe request
 def sessionify_signed_request
   if request_parameter = request.params["signed_request"]
     session[:signed_request] = request_parameter
     logger.info "  Facebook Signed Request received. Stored/updated in session."
   else
     params["signed_request"] = session[:signed_request]
     logger.info "  No Facebook Signed Request received. Loaded, if present, from session."
   end
 end
 Ensures, using configuration options, that the request was signed by Facebook