aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_controller/vendor/rack-1.0/rack/auth/abstract/handler.rb
blob: b213eac6f434eeb3ebe8d372f59f7c60e1bcbfb0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
module Rack
  module Auth
    # Rack::Auth::AbstractHandler implements common authentication functionality.
    #
    # +realm+ should be set for all handlers.

    class AbstractHandler

      attr_accessor :realm

      def initialize(app, &authenticator)
        @app, @authenticator = app, authenticator
      end


      private

      def unauthorized(www_authenticate = challenge)
        return [ 401, { 'WWW-Authenticate' => www_authenticate.to_s }, [] ]
      end

      def bad_request
        [ 400, {}, [] ]
      end

    end
  end
end