Sha256: d5c35e489f8552a7051c7a3dd64299d5aa8c9d4df4afeff7d323bde26ecf7905

Contents?: true

Size: 697 Bytes

Versions: 11

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true

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

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

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

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
httpx-1.3.4 lib/httpx/plugins/basic_auth.rb
httpx-1.3.3 lib/httpx/plugins/basic_auth.rb
httpx-1.3.2 lib/httpx/plugins/basic_auth.rb
httpx-1.3.1 lib/httpx/plugins/basic_auth.rb
httpx-1.3.0 lib/httpx/plugins/basic_auth.rb
httpx-1.2.6 lib/httpx/plugins/basic_auth.rb
httpx-1.2.4 lib/httpx/plugins/basic_auth.rb
httpx-1.2.3 lib/httpx/plugins/basic_auth.rb
httpx-1.2.2 lib/httpx/plugins/basic_auth.rb
httpx-1.2.1 lib/httpx/plugins/basic_auth.rb
httpx-1.2.0 lib/httpx/plugins/basic_auth.rb