Sha256: 262379bf066bbaa46c99ae66f2f08e68a48554953205c15cbe9718fd9f6fd44f

Contents?: true

Size: 696 Bytes

Versions: 7

Compression:

Stored size: 696 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/Authorization#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

7 entries across 7 versions & 1 rubygems

Version Path
httpx-1.1.3 lib/httpx/plugins/basic_auth.rb
httpx-1.1.2 lib/httpx/plugins/basic_auth.rb
httpx-1.1.1 lib/httpx/plugins/basic_auth.rb
httpx-1.1.0 lib/httpx/plugins/basic_auth.rb
httpx-1.0.2 lib/httpx/plugins/basic_auth.rb
httpx-1.0.1 lib/httpx/plugins/basic_auth.rb
httpx-1.0.0 lib/httpx/plugins/basic_auth.rb