class HTTPX::Plugins::Authentication::Ntlm

  1. lib/httpx/plugins/auth/ntlm.rb
Superclass: Object

Methods

Public Class

  1. new

Public Instance

  1. authenticate
  2. can_authenticate?
  3. negotiate

Public Class methods

new(user, password, domain: nil)
[show source]
   # File lib/httpx/plugins/auth/ntlm.rb
10 def initialize(user, password, domain: nil)
11   @user = user
12   @password = password
13   @domain = domain
14 end

Public Instance methods

authenticate(_req, www)
[show source]
   # File lib/httpx/plugins/auth/ntlm.rb
24 def authenticate(_req, www)
25   challenge = www[/NTLM (.*)/, 1]
26 
27   challenge = Base64.decode64(challenge)
28   ntlm_challenge = NTLM.authenticate(challenge, @user, @domain, @password).to_base64
29 
30   "NTLM #{ntlm_challenge}"
31 end
can_authenticate?(authenticate)
[show source]
   # File lib/httpx/plugins/auth/ntlm.rb
16 def can_authenticate?(authenticate)
17   authenticate && /NTLM .*/.match?(authenticate)
18 end
negotiate()
[show source]
   # File lib/httpx/plugins/auth/ntlm.rb
20 def negotiate
21   "NTLM #{NTLM.negotiate(domain: @domain).to_base64}"
22 end