Class: Minbox::AuthPlain

Inherits:
Object
  • Object
show all
Defined in:
lib/minbox/client.rb

Instance Method Summary collapse

Instance Method Details

#run(client, line) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/minbox/client.rb', line 58

def run(client, line)
  data = line.gsub(/AUTH PLAIN ?/i, '')
  if data.strip == ''
    client.write '334'
    data = client.read
  end
  parts = Base64.decode64(data).split("\0")
  username = parts[-2]
  password = parts[-1]
  client.authenticate(username, password)
end