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

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

Instance Method Summary collapse

Constructor Details

#initialize(user, password) ⇒ Digest

Returns a new instance of Digest.



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

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

Instance Method Details

#authenticate(request, authenticate) ⇒ Object



23
24
25
# File 'lib/httpx/plugins/authentication/digest.rb', line 23

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

#can_authenticate?(authenticate) ⇒ Boolean

Returns:



19
20
21
# File 'lib/httpx/plugins/authentication/digest.rb', line 19

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