Class: Net::SMTP::AuthNTLM

Inherits:
Authenticator
  • Object
show all
Defined in:
lib/net/smtp/auth_ntlm.rb

Overview

Provides NTLM authentication for Net::SMTP. based on example from github.com/WinRb/rubyntlm/blob/master/examples/smtp.rb and old Net::SMTP NTLM implementation from github.com/macks/ruby-ntlm/blob/master/lib/ntlm/smtp.rb

Instance Method Summary collapse

Instance Method Details

#auth(user, secret) ⇒ Object

Raises:

  • (Net::SMTPAuthenticationError)


13
14
15
16
17
18
19
20
21
22
23
# File 'lib/net/smtp/auth_ntlm.rb', line 13

def auth(user, secret)
  raise Net::SMTPAuthenticationError, "NTLM not supported" unless smtp.auth_capable?("NTLM")

  domain, user = if user.index("\\")
                   user.split("\\", 2)
                 else
                   ["", user]
                 end

  perform_auth(user, domain, secret)
end