From 6a560290805ff49d7d43842dd8119a2e2bb06b4a Mon Sep 17 00:00:00 2001 From: Christoph Helma Date: Thu, 2 Sep 2010 13:09:19 +0200 Subject: old user authentification removed --- lib/authorization.rb | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 lib/authorization.rb (limited to 'lib/authorization.rb') diff --git a/lib/authorization.rb b/lib/authorization.rb deleted file mode 100644 index 9a1760a..0000000 --- a/lib/authorization.rb +++ /dev/null @@ -1,24 +0,0 @@ -helpers do - - def protected! - response['WWW-Authenticate'] = %(Basic realm="Opentox Webservice Authentication") and \ - throw(:halt, [401, "Not authorized\n"]) and \ - return unless authorized? - end - - def authorized? - @auth ||= Rack::Auth::Basic::Request.new(request.env) - @auth.provided? && @auth.basic? && @auth.credentials && valid_user? - end - - def valid_user? - users = @@users[:users] - return @auth.credentials == [@auth.username, users.fetch(@auth.username)] if users.has_key?(@auth.username) - return false - end - -end - -before do - #protected! unless env['REQUEST_METHOD'] == "GET" -end -- cgit v1.2.3