Sha256: ab5d913eebbe59e86cd476b38867e223aea2b0dd3c194ed805d916ad9b1ff441

Contents?: true

Size: 605 Bytes

Versions: 15

Compression:

Stored size: 605 Bytes

Contents

module DiscoApp::Concerns::CarrierRequestController
  extend ActiveSupport::Concern

  included do
    before_action :verify_carrier_request
  end

  private

    def verify_carrier_request
      unless carrier_request_signature_is_valid?
        head :unauthorized
      end
    end

    def carrier_request_signature_is_valid?
      return true if Rails.env.development? and DiscoApp.configuration.skip_carrier_request_verification?
      DiscoApp::CarrierRequestService.is_valid_hmac?(request.body.read.to_s, ShopifyApp.configuration.secret, request.headers['HTTP_X_SHOPIFY_HMAC_SHA256'])
    end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
disco_app-0.8.8 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.8.9 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.0 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.1 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.2 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.3 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.4 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.5 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.6 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.7 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.8 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.9 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.10 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.9.11 app/controllers/disco_app/concerns/carrier_request_controller.rb
disco_app-0.10.0 app/controllers/disco_app/concerns/carrier_request_controller.rb