Sha256: 8f7992bd3e52c2e750d9f6ad1dc0c0c0b42f994d5882b9275f6d9481e072549f

Contents?: true

Size: 738 Bytes

Versions: 22

Compression:

Stored size: 738 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 BasicAuthentication
      def self.load_dependencies(klass)
        require "base64"
        klass.plugin(:authentication)
      end

      module InstanceMethods
        def basic_authentication(user, password)
          authentication("Basic #{Base64.strict_encode64("#{user}:#{password}")}")
        end
        alias_method :basic_auth, :basic_authentication
      end
    end
    register_plugin :basic_authentication, BasicAuthentication
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
httpx-0.13.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.13.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.13.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.12.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.11.3 lib/httpx/plugins/basic_authentication.rb
httpx-0.11.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.11.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.11.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.10.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.10.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.10.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.9.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.8.2 lib/httpx/plugins/basic_authentication.rb
httpx-0.8.1 lib/httpx/plugins/basic_authentication.rb
httpx-0.8.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.7.0 lib/httpx/plugins/basic_authentication.rb
httpx-0.6.7 lib/httpx/plugins/basic_authentication.rb
httpx-0.6.6 lib/httpx/plugins/basic_authentication.rb
httpx-0.6.5 lib/httpx/plugins/basic_authentication.rb
httpx-0.6.4 lib/httpx/plugins/basic_authentication.rb