Module: Grape::Middleware::Auth::Strategies

Defined in:
lib/grape/middleware/auth/strategies.rb

Class Method Summary collapse

Class Method Details

.[](label) ⇒ Object


18
19
20
# File 'lib/grape/middleware/auth/strategies.rb', line 18

def [](label)
  auth_strategies[label]
end

.add(label, strategy, option_fetcher = ->(_) { [] }) ⇒ Object


7
8
9
# File 'lib/grape/middleware/auth/strategies.rb', line 7

def add(label, strategy, option_fetcher = ->(_) { [] })
  auth_strategies[label] =  StrategyInfo.new(strategy, option_fetcher)
end

.auth_strategiesObject


11
12
13
14
15
16
# File 'lib/grape/middleware/auth/strategies.rb', line 11

def auth_strategies
  @auth_strategies ||= {
    http_basic: StrategyInfo.new(Rack::Auth::Basic, ->(settings) { [settings[:realm]] }),
    http_digest: StrategyInfo.new(Rack::Auth::Digest::MD5, ->(settings) { [settings[:realm], settings[:opaque]] })
  }
end