Class: Grape::Middleware::Auth::Base
- Defined in:
- lib/grape/middleware/auth/base.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
- #call!(env) ⇒ Object
-
#initialize(app, **options) ⇒ Base
constructor
A new instance of Base.
Methods inherited from Base
#after, #before, #call, #content_type, #content_type_for, #content_types, #context, #mime_types, #query_params, #rack_request, #response
Methods included from DSL::Headers
Constructor Details
#initialize(app, **options) ⇒ Base
Returns a new instance of Base.
7 8 9 10 11 12 |
# File 'lib/grape/middleware/auth/base.rb', line 7 def initialize(app, **) super @auth_strategy = Grape::Middleware::Auth::Strategies[[:type]].tap do |auth_strategy| raise Grape::Exceptions::UnknownAuthStrategy.new(strategy: [:type]) unless auth_strategy end end |
Instance Method Details
#call!(env) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/grape/middleware/auth/base.rb', line 14 def call!(env) @env = env @auth_strategy.create(app, ) do |*args| context.instance_exec(*args, &[:proc]) end.call(env) end |