Sha256: 583b5b2adfcdb129b3f773f10308bd5a4f6482a793c9a450ad6bc44b1ee326aa

Contents?: true

Size: 805 Bytes

Versions: 8

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

module HTTPX
  module Plugins
    #
    # This plugin adds helper methods to implement HTTP Basic Auth (https://tools.ietf.org/html/rfc7617)
    #
    # https://gitlab.com/honeyryderchuck/httpx/wikis/Authentication#basic-authentication
    #
    module BasicAuth
      class << self
        def load_dependencies(_klass)
          require_relative "authentication/basic"
        end

        def configure(klass)
          klass.plugin(:authentication)
        end
      end

      module InstanceMethods
        def basic_auth(user, password)
          authentication(Authentication::Basic.new(user, password).authenticate)
        end
        alias_method :basic_authentication, :basic_auth
      end
    end
    register_plugin :basic_authentication, BasicAuth
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
httpx-0.21.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.21.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.20.5 lib/httpx/plugins/basic_authentication.rb
httpx-0.20.4 lib/httpx/plugins/basic_authentication.rb
httpx-0.20.3 lib/httpx/plugins/basic_authentication.rb
httpx-0.20.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.20.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.20.0 lib/httpx/plugins/basic_authentication.rb