Class: Grape::Middleware::Auth::Digest
- Inherits:
-
Base
- Object
- Base
- Grape::Middleware::Auth::Digest
- Defined in:
- lib/grape/middleware/auth/digest.rb
Instance Attribute Summary (collapse)
-
- (Object) authenticator
readonly
Returns the value of attribute authenticator.
Attributes inherited from Base
Instance Method Summary (collapse)
- - (Object) before
- - (Object) credentials
- - (Object) digest_request
-
- (Digest) initialize(app, options = {}, &authenticator)
constructor
A new instance of Digest.
Methods inherited from Base
#after, #call, #call!, #content_type, #content_type_for, #content_types, #default_options, #mime_types, #request, #response
Constructor Details
- (Digest) initialize(app, options = {}, &authenticator)
A new instance of Digest
9 10 11 12 |
# File 'lib/grape/middleware/auth/digest.rb', line 9 def initialize(app, = {}, &authenticator) super(app, ) @authenticator = authenticator end |
Instance Attribute Details
- (Object) authenticator (readonly)
Returns the value of attribute authenticator
7 8 9 |
# File 'lib/grape/middleware/auth/digest.rb', line 7 def authenticator @authenticator end |
Instance Method Details
- (Object) before
22 23 24 25 26 |
# File 'lib/grape/middleware/auth/digest.rb', line 22 def before unless authenticator.call(*credentials) throw :error, :status => 401, :message => "API Authorization Failed." end end |
- (Object) credentials
18 19 20 |
# File 'lib/grape/middleware/auth/digest.rb', line 18 def credentials digest_request.provided?? digest_request.credentials : [nil, nil] end |
- (Object) digest_request
14 15 16 |
# File 'lib/grape/middleware/auth/digest.rb', line 14 def digest_request Rack::Auth::Digest::Request.new(env) end |