Class: Flightdeck::ApplicationController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/flightdeck/application_controller.rb

Constant Summary collapse

UNCONFIGURED_MESSAGE =
<<~TEXT
  Flightdeck is not configured for authentication, so it is refusing to
  serve the dashboard.

  Pick one of the following, then restart your app.

  1. HTTP Basic via environment variables:

       FLIGHTDECK_USERNAME=admin FLIGHTDECK_PASSWORD=a-long-secret

  2. HTTP Basic via Rails credentials (bin/rails credentials:edit):

       flightdeck:
         username: admin
         password: a-long-secret

  3. HTTP Basic in an initializer (config/initializers/flightdeck.rb):

       Flightdeck.configure do |config|
         config.http_basic = { username: "admin", password: "a-long-secret" }
       end

  4. Reuse your application's own authentication by giving Flightdeck a
     base controller to inherit from:

       Flightdeck.configure do |config|
         config.base_controller_class = "Admin::BaseController"
       end

  5. If something upstream (a routing constraint, VPN, or reverse proxy)
     already guards this mount and you accept the risk, turn Flightdeck's
     gate off entirely:

       Flightdeck.configure do |config|
         config.skip_authentication = true
       end

  Flightdeck never serves unauthenticated requests, in any environment,
  unless it is explicitly told to with skip_authentication.
TEXT

Class Method Summary collapse

Class Method Details

.host_authenticated?Boolean

True when the host handed us its own base controller: that controller's own filters are already in our callback chain, so Flightdeck must not layer a second, conflicting challenge on top of it.

Returns:

  • (Boolean)


68
69
70
# File 'app/controllers/flightdeck/application_controller.rb', line 68

def host_authenticated?
  Flightdeck.config.base_controller_class.present?
end