Class: HTTPX::Plugins::Authentication::Digest

Inherits:
Object
  • Object
show all
Defined in:
lib/httpx/plugins/auth/digest.rb

Constant Summary collapse

Error =
Class.new(Error)

Instance Method Summary collapse

Constructor Details

#initialize(user, password, hashed: false) ⇒ Digest

Returns a new instance of Digest.



13
14
15
16
17
18
# File 'lib/httpx/plugins/auth/digest.rb', line 13

def initialize(user, password, hashed: false, **)
  @user = user
  @password = password
  @nonce = 0
  @hashed = hashed
end

Instance Method Details

#authenticate(request, authenticate) ⇒ Object



24
25
26
# File 'lib/httpx/plugins/auth/digest.rb', line 24

def authenticate(request, authenticate)
  "Digest #{generate_header(request.verb, request.path, authenticate)}"
end

#can_authenticate?(authenticate) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/httpx/plugins/auth/digest.rb', line 20

def can_authenticate?(authenticate)
  authenticate && /Digest .*/.match?(authenticate)
end