123456789_123456789_123456789_123456789_123456789_

Class: Rack::Auth::AbstractHandler

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Subclasses:
Inherits: Object
Defined in: lib/rack/auth/abstract/handler.rb

Overview

AbstractHandler implements common authentication functionality.

#realm should be set for all handlers.

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(app, realm = nil, &authenticator) ⇒ AbstractHandler

[ GitHub ]

  
# File 'lib/rack/auth/abstract/handler.rb', line 15

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

Instance Attribute Details

#realm (rw)

[ GitHub ]

  
# File 'lib/rack/auth/abstract/handler.rb', line 13

attr_accessor :realm

Instance Method Details

#bad_request (private)

[ GitHub ]

  
# File 'lib/rack/auth/abstract/handler.rb', line 31

def bad_request
  return [ 400,
    { CONTENT_TYPE => 'text/plain',
      CONTENT_LENGTH => '0' },
    []
  ]
end

#unauthorized(www_authenticate = challenge) (private)

[ GitHub ]

  
# File 'lib/rack/auth/abstract/handler.rb', line 22

def unauthorized(www_authenticate = challenge)
  return [ 401,
    { CONTENT_TYPE => 'text/plain',
      CONTENT_LENGTH => '0',
      'www-authenticate' => www_authenticate.to_s },
    []
  ]
end