Sha256: 17a5fb67967a53b31b5f6aaa308da8d2f48c03f2c69acf27bd364f3b12dbe2d1

Contents?: true

Size: 687 Bytes

Versions: 2

Compression:

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

2 entries across 2 versions & 1 rubygems

Version Path
httpx-1.1.5 lib/httpx/plugins/basic_auth.rb
httpx-1.1.4 lib/httpx/plugins/basic_auth.rb