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

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

Defined Under Namespace

Classes: Error

Instance Method Summary collapse

Constructor Details

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

Returns a new instance of Digest.



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

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

Instance Method Details

#authenticate(request, authenticate) ⇒ Object



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

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

#can_authenticate?(authenticate) ⇒ Boolean

Returns:

  • (Boolean)


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

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