Sha256: adc4d5f02e2f4085b1f1748a946303b9ee1a4f27af472d1c2e3647704f25b446

Contents?: true

Size: 686 Bytes

Versions: 16

Compression:

Stored size: 686 Bytes

Contents

# frozen_string_literal: true

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

16 entries across 16 versions & 2 rubygems

Version Path
grape-1.8.0 lib/grape/middleware/auth/strategies.rb
grape-1.7.1 lib/grape/middleware/auth/strategies.rb
grape-1.7.0 lib/grape/middleware/auth/strategies.rb
grape-1.6.2 lib/grape/middleware/auth/strategies.rb
grape-1.6.1 lib/grape/middleware/auth/strategies.rb
grape-1.6.0 lib/grape/middleware/auth/strategies.rb
grape-1.5.3 lib/grape/middleware/auth/strategies.rb
grape-1.5.2 lib/grape/middleware/auth/strategies.rb
grape-1.5.1 lib/grape/middleware/auth/strategies.rb
grape-1.5.0 lib/grape/middleware/auth/strategies.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/grape-1.4.0/lib/grape/middleware/auth/strategies.rb
grape-1.4.0 lib/grape/middleware/auth/strategies.rb
grape-1.3.3 lib/grape/middleware/auth/strategies.rb
grape-1.3.2 lib/grape/middleware/auth/strategies.rb
grape-1.3.1 lib/grape/middleware/auth/strategies.rb
grape-1.3.0 lib/grape/middleware/auth/strategies.rb