Sha256: 989898ab62d7d8cb4888ee5a10a3c99be320964edf8f13eb61259e9ea1660092

Contents?: true

Size: 436 Bytes

Versions: 5

Compression:

Stored size: 436 Bytes

Contents

# frozen_string_literal: true

module BasicAuthentication
  extend ActiveSupport::Concern

  included do
    before_action :authenticate
  end

  private

  def authenticate
    return unless ENV['BASIC_AUTH_IS_ACTIVE'] == 'yes'
    authenticate_or_request_with_http_basic do |username, password|
      username == basic_auth.username && password == basic_auth.password
    end
  end

  def basic_auth
    Settings.basic_auth
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
cybele-2.3.2 templates/basic_authentication/basic_authentication.rb
cybele-2.3.1 templates/basic_authentication/basic_authentication.rb
cybele-2.2.0 templates/basic_authentication/basic_authentication.rb
cybele-2.1.0 templates/basic_authentication/basic_authentication.rb
cybele-2.0.0 templates/basic_authentication/basic_authentication.rb