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

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

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Digest.



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

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

Instance Method Details

#authenticate(request, authenticate) ⇒ Object



22
23
24
# File 'lib/httpx/plugins/auth/digest.rb', line 22

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

#can_authenticate?(authenticate) ⇒ Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/httpx/plugins/auth/digest.rb', line 18

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