Sha256: e4ddd1382683e11c84631f5a07f02fbcf27802e79371d86a55088e73f1f76fef

Contents?: true

Size: 656 Bytes

Versions: 5

Compression:

Stored size: 656 Bytes

Contents

module Grape
  module Middleware
    module Auth
      module Strategies
        module_function

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

        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

        def [](label)
          auth_strategies[label]
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
grape-0.13.0 lib/grape/middleware/auth/strategies.rb
grape-0.12.0 lib/grape/middleware/auth/strategies.rb
grape-0.11.0 lib/grape/middleware/auth/strategies.rb
grape-0.10.1 lib/grape/middleware/auth/strategies.rb
grape-0.10.0 lib/grape/middleware/auth/strategies.rb