lib/authenticators.rb in Soks-0.0.2 vs lib/authenticators.rb in Soks-0.0.3
- old
+ new
@@ -3,12 +3,28 @@
require 'webrick/httpauth/authenticator'
require 'base64'
module WEBrick
module HTTPAuth
- class NotAuthentication
+
+ class NoAuthenticationRequired
+ def authenticate(req, res)
+ req.user = req.meta_vars["HTTP_X_FORWARDED_FOR"] || req.meta_vars["REMOTE_ADDR"]
+ end
+ end
+
+ class NotPermitted
+
+ def authenticate(req, res)
+ raise WEBrick::HTTPStatus::Unauthorized
+ end
+
+ end
+
+ class AskForUserName
+
include WEBrick::HTTPAuth::Authenticator
AuthScheme = "Basic"
def initialize( realm = "editing" )
@@ -34,10 +50,10 @@
res[@response_field] = "#{@auth_scheme} realm=\"#{@realm}\""
raise @auth_exception
end
end
- class OnePasswordAuthentication
+ class SiteWidePassword
include Authenticator
AuthScheme = "Basic"
attr_reader :realm, :userdb, :logger