Sha256: c6218c296e4f467af4f96923a6b0b0df9a227c7504177b4174f75ba4155be598

Contents?: true

Size: 794 Bytes

Versions: 19

Compression:

Stored size: 794 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/os85/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

19 entries across 19 versions & 1 rubygems

Version Path
httpx-0.24.7 lib/httpx/plugins/basic_authentication.rb
httpx-0.24.6 lib/httpx/plugins/basic_authentication.rb
httpx-0.24.5 lib/httpx/plugins/basic_authentication.rb
httpx-0.24.4 lib/httpx/plugins/basic_authentication.rb
httpx-0.24.3 lib/httpx/plugins/basic_authentication.rb
httpx-0.24.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.24.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.24.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.23.4 lib/httpx/plugins/basic_authentication.rb
httpx-0.23.3 lib/httpx/plugins/basic_authentication.rb
httpx-0.23.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.23.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.23.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.22.5 lib/httpx/plugins/basic_authentication.rb
httpx-0.22.4 lib/httpx/plugins/basic_authentication.rb
httpx-0.22.3 lib/httpx/plugins/basic_authentication.rb
httpx-0.22.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.22.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.22.0 lib/httpx/plugins/basic_authentication.rb