Class: Net::SMTP

Inherits:
Object
  • Object
show all
Defined in:
lib/ntlm/smtp.rb

Instance Method Summary collapse

Instance Method Details

#auth_ntlm(user, secret) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ntlm/smtp.rb', line 11

def auth_ntlm(user, secret)
  check_auth_args(user, secret)
  if user.index('\\')
    domain, user = user.split('\\', 2)
  else
    domain = ''
  end

  res = critical {
    r = get_response("AUTH NTLM #{NTLM.negotiate.to_base64}")
    check_auth_continue(r)
    challenge = r.string.split(/ /, 2).last.unpack('m').first
    get_response(NTLM.authenticate(challenge, user, domain, secret).to_base64)
  }
  check_auth_response(res)
  res
end

#capable_ntlm_auth?Boolean

Returns:

  • (Boolean)


7
8
9
# File 'lib/ntlm/smtp.rb', line 7

def capable_ntlm_auth?
  auth_capable?('NTLM')
end