Sha256: 5e7ce720f30f4d9359e2e98f4c29cbdb65079fb376777688e22c2873c6908f4a

Contents?: true

Size: 819 Bytes

Versions: 1

Compression:

Stored size: 819 Bytes

Contents

Workarea.configure do |config|
  basic_auth = ActiveSupport::Configurable::Configuration.new
  basic_auth.enabled = false

  basic_auth.protect_routes = Workarea::BasicAuth::SimpleRouteSet.new
  basic_auth.exclude_routes = Workarea::BasicAuth::SimpleRouteSet.new

  basic_auth.exclude_routes.add("/*", ->(request) {
    request.env["HTTP_USER_AGENT"].to_s.include?("ELB-HealthChecker")
  })

  basic_auth.protect_routes.add("/*")
  basic_auth.exclude_routes.add("/api*")
  basic_auth.exclude_routes.add("/assets/*")
  basic_auth.exclude_routes.add("/media/*")
  basic_auth.exclude_routes.add("/product_images/*")

  basic_auth.whitelisted_ips = Rack::Attack::ALERT_LOGIC_IP_ADDRESSES

  Workarea.config.basic_auth = basic_auth

  Rails.application.config.middleware.insert_before 0, Workarea::BasicAuth::Middleware
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
workarea-basic_auth-1.1.1 config/initializers/access_control.rb