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

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

Constant Summary collapse

Error =

Returns:

Instance Method Summary collapse

Instance Method Details

#authenticate(request, authenticate) ⇒ String?

Parameters:

  • request (Request)
  • authenticate (String)

Returns:

  • (String, nil)


24
25
26
27
28
29
30
31
# File 'lib/httpx/plugins/auth/digest.rb', line 24

def authenticate(request, authenticate)
  "Digest #{generate_header(request.verb, request.path, authenticate)}"
rescue HTTPX::Error => e
  response = ErrorResponse.new(request, e)
  request.response = response
  request.emit_response(response)
  nil
end

#can_authenticate?(authenticate) ⇒ Boolean

Parameters:

  • authenticate (String, nil)

Returns:

  • (Boolean)


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

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