class Octopusci::Server

Public Instance Methods

authorized?() click to toggle source
# File lib/octopusci/server.rb, line 22
def authorized?
  @auth ||=  Rack::Auth::Basic::Request.new(request.env)        
  @auth.provided? && @auth.basic? && @auth.credentials && @auth.credentials == [ Octopusci::Config['http_basic']['username'], Octopusci::Config['http_basic']['password'] ]
end
protected!() click to toggle source
# File lib/octopusci/server.rb, line 15
def protected!
  unless authorized?
    response['WWW-Authenticate'] = %(Basic realm="Restricted Area")
    throw(:halt, [401, "Not authorized\n"])
  end
end