diff options
author | Tim Fletcher <twoggle@gmail.com> | 2007-03-26 21:27:00 +0000 |
---|---|---|
committer | Tim Fletcher <twoggle@gmail.com> | 2007-03-26 21:27:00 +0000 |
commit | 0186ca16903589c60f6d9c6a50a1a9e8f830c288 (patch) | |
tree | e7f7c44fdca45756f1a132f8b6449e074fdb2630 /lib/rack/auth/abstract/handler.rb | |
parent | 2800d6069820e91c6a6c63a02ee9432176bfeedd (diff) | |
download | rack-0186ca16903589c60f6d9c6a50a1a9e8f830c288.tar.gz |
Adding Rack::Auth::Digest::MD5, and refactoring Auth::Basic accordingly
darcs-hash:20070326212732-5d7f7-7878374ff363bdf14952ebb169619b111cad3fb7.gz
Diffstat (limited to 'lib/rack/auth/abstract/handler.rb')
-rw-r--r-- | lib/rack/auth/abstract/handler.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/rack/auth/abstract/handler.rb b/lib/rack/auth/abstract/handler.rb new file mode 100644 index 00000000..00cddb07 --- /dev/null +++ b/lib/rack/auth/abstract/handler.rb @@ -0,0 +1,25 @@ +module Rack + module Auth + class AbstractHandler + + attr_accessor :realm + + def initialize(app, &authenticator) + @app, @authenticator = app, authenticator + end + + def unauthorized(www_authenticate = challenge) + headers = { + 'Content-Type' => 'text/html', + 'WWW-Authenticate' => www_authenticate.to_s + } + return [ 401, headers, ['<h1>401 Unauthorized</h1>'] ] + end + + def bad_request + [ 400, { 'Content-Type' => 'text/html' }, ['<h1>400 Bad Request</h1>'] ] + end + + end + end +end
\ No newline at end of file |