Updated README.rdoc again
[feedcatcher.git] / vendor / rails / actionpack / lib / action_controller / vendor / rack-1.0 / rack / auth / abstract / handler.rb
1 module Rack
2 module Auth
3 # Rack::Auth::AbstractHandler implements common authentication functionality.
4 #
5 # +realm+ should be set for all handlers.
6
7 class AbstractHandler
8
9 attr_accessor :realm
10
11 def initialize(app, realm=nil, &authenticator)
12 @app, @realm, @authenticator = app, realm, authenticator
13 end
14
15
16 private
17
18 def unauthorized(www_authenticate = challenge)
19 return [ 401,
20 { 'Content-Type' => 'text/plain',
21 'Content-Length' => '0',
22 'WWW-Authenticate' => www_authenticate.to_s },
23 []
24 ]
25 end
26
27 def bad_request
28 return [ 400,
29 { 'Content-Type' => 'text/plain',
30 'Content-Length' => '0' },
31 []
32 ]
33 end
34
35 end
36 end
37 end