Class: SolidObserver::Services::UiAuthCheck

Inherits:
Object
  • Object
show all
Defined in:
lib/solid_observer/services/ui_auth_check.rb

Overview

Logs a boot-time WARNING when the Web UI’s HTTP Basic Auth is misconfigured.

No-ops when the UI is disabled or both credentials are set. Otherwise logs one of two warnings: “no auth configured” (neither credential set) or “auth misconfigured” (exactly one set, naming the missing one).

The UI ships fail-open on partial credentials — see SolidObserver::ApplicationController#authenticate.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config, logger) ⇒ UiAuthCheck

Returns a new instance of UiAuthCheck.



18
19
20
21
# File 'lib/solid_observer/services/ui_auth_check.rb', line 18

def initialize(config, logger)
  @config = config
  @logger = logger
end

Class Method Details

.call(config:, logger: Rails.logger) ⇒ Object



14
15
16
# File 'lib/solid_observer/services/ui_auth_check.rb', line 14

def self.call(config:, logger: Rails.logger)
  new(config, logger).call
end

Instance Method Details

#callObject



23
24
25
26
27
28
# File 'lib/solid_observer/services/ui_auth_check.rb', line 23

def call
  return unless config.ui_enabled

  warning = warning_message
  logger.warn(warning) if warning
end