Module: Grape::Middleware::Auth::DSL
- Included in:
- API::Instance
- Defined in:
- lib/grape/middleware/auth/dsl.rb
Instance Method Summary collapse
- #auth(type = nil, **options, &block) ⇒ Object
-
#http_basic(**options) ⇒ Object
Add HTTP Basic authorization to the API.
Instance Method Details
#auth(type = nil, **options, &block) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/grape/middleware/auth/dsl.rb', line 7 def auth(type = nil, **, &block) return inheritable_setting.auth unless type inheritable_setting.auth = { type: type.to_sym, proc: block }.merge!() use Grape::Middleware::Auth::Base, inheritable_setting.auth end |
#http_basic(**options) ⇒ Object
Add HTTP Basic authorization to the API.
18 19 20 21 |
# File 'lib/grape/middleware/auth/dsl.rb', line 18 def http_basic(**, &) [:realm] ||= 'API Authorization' auth(:http_basic, **, &) end |