Sha256: 5d308bd8d261bc600d7c77e51a2dc8be8856c98dae7cfbd8d0a8451a964b9912

Contents?: true

Size: 655 Bytes

Versions: 22

Compression:

Stored size: 655 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

22 entries across 22 versions & 2 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.2.5/lib/grape/middleware/auth/strategies.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/grape-1.2.5/lib/grape/middleware/auth/strategies.rb
grape-1.2.5 lib/grape/middleware/auth/strategies.rb
grape-1.2.4 lib/grape/middleware/auth/strategies.rb
grape-1.2.3 lib/grape/middleware/auth/strategies.rb
grape-1.2.2 lib/grape/middleware/auth/strategies.rb
grape-1.2.1 lib/grape/middleware/auth/strategies.rb
grape-1.2.0 lib/grape/middleware/auth/strategies.rb
grape-1.1.0 lib/grape/middleware/auth/strategies.rb
grape-1.0.3 lib/grape/middleware/auth/strategies.rb
grape-1.0.2 lib/grape/middleware/auth/strategies.rb
grape-1.0.1 lib/grape/middleware/auth/strategies.rb
grape-1.0.0 lib/grape/middleware/auth/strategies.rb
grape-0.19.2 lib/grape/middleware/auth/strategies.rb
grape-0.19.1 lib/grape/middleware/auth/strategies.rb
grape-0.19.0 lib/grape/middleware/auth/strategies.rb
grape-0.18.0 lib/grape/middleware/auth/strategies.rb
grape-0.17.0 lib/grape/middleware/auth/strategies.rb
grape-0.16.2 lib/grape/middleware/auth/strategies.rb
grape-0.16.1 lib/grape/middleware/auth/strategies.rb