Sha256: 6e3e08d57f86c18381dd81f299b8643b32f5c911897d643bbee5cd3a761fd558
Contents?: true
Size: 1.14 KB
Versions: 3
Compression:
Stored size: 1.14 KB
Contents
module Vidibus module Secure module Extensions # Contains extensions of ApplicationController. module Controller extend ActiveSupport::Concern included do helper_method(:valid_request?) if respond_to?(:helper_method) end # Generates a signature of a request path. # Will use the current request.fullpath unless an URI is given. # # The given URI will be decomposed into path and request params. # A given +signature_param+ will be removed, all remaining params # will be ordered alphabetically. # # Usage: # # valid_request?("mysecret") # valid_request?("mysecret", :uri => "http://...", :method => "get", :params => {}) # def valid_request?(secret, options = {}) method = options.delete(:method) || request.method uri = options.delete(:uri) || request.protocol + request.host_with_port + request.fullpath params = options.delete(:params) || request.request_parameters Vidibus::Secure.verify_request(method, uri, params, secret) end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems