Sha256: a372b16302b9e764efbf52caa2f246c2291d778ec2dd9b5841b580becc4bfeaf

Contents?: true

Size: 854 Bytes

Versions: 9

Compression:

Stored size: 854 Bytes

Contents

module ActiveTracker
  class BaseController < ActionController::Base
    protect_from_forgery with: :exception

    layout "active_tracker/active_tracker"

    before_action do
      if ActiveTracker::Configuration.authentication.is_a? String
        username, password = ActiveTracker::Configuration.authentication.split(":")
        unless authenticate_with_http_basic { |u, p| u == username && p == password}
          request_http_basic_authentication
        end
      elsif ActiveTracker::Configuration.authentication.is_a? Proc
        unless self.instance_eval &ActiveTracker::Configuration.authentication
          # Raise a 404, as we'd rather not let people know the URL is available
          # unless we have to for basic authentication
          raise ActionController::RoutingError.new('Not Found')
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activetracker-0.4.8 app/controllers/active_tracker/base_controller.rb
activetracker-0.4.7 app/controllers/active_tracker/base_controller.rb
activetracker-0.4.6 app/controllers/active_tracker/base_controller.rb
activetracker-0.4.5 app/controllers/active_tracker/base_controller.rb
activetracker-0.4.4 app/controllers/active_tracker/base_controller.rb
activetracker-0.4.3 app/controllers/active_tracker/base_controller.rb
activetracker-0.4.2 app/controllers/active_tracker/base_controller.rb
activetracker-0.4.1 app/controllers/active_tracker/base_controller.rb
activetracker-0.4.0 app/controllers/active_tracker/base_controller.rb