module SnipSnap::AuthExtension

Public Class Methods

registered(app) click to toggle source
# File lib/snipsnap/extensions/auth.rb, line 20
def self.registered(app)
  app.helpers Helpers

  app.error 401..403 do
    headers = {
      'WWW-Authenticate' => %(Basic realm="Restricted Area")
    }
    body = {
      error: 'Unauthorized'
    }.to_json

    halt 401, headers, body
  end
end