Sha256: 18fb9260701aed12850aac5afd147c7dbf29a5a2b6faef2aab8ed23a80f499b3

Contents?: true

Size: 343 Bytes

Versions: 2

Compression:

Stored size: 343 Bytes

Contents

module SimpleAdmin
  class BaseController < ActionController::API
    before_action :verify_key_is_valid!

    private

      def verify_key_is_valid!
        return head(:forbidden) if key_is_invalid?
      end

      def key_is_invalid?
        request.headers['SimpleAdmin-Secret-Key'] != ENV['SIMPLE_ADMIN_SECRET_KEY']
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
simpleadmin-1.4.0 app/controllers/simple_admin/base_controller.rb
simpleadmin-1.3.0 app/controllers/simple_admin/base_controller.rb