aboutsummaryrefslogtreecommitdiffstats
path: root/lib/net/imap.rb
diff options
context:
space:
mode:
authorshugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-26 07:26:15 +0000
committershugo <shugo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-12-26 07:26:15 +0000
commit4394e19fddbfafb762fc6bd427e68370d41a0cee (patch)
treed8b05fcb2fb7b0fbac9567331b7b531d1a666fdc /lib/net/imap.rb
parent0634c0761033d05e20dbc2d2dd56819b60b73fbc (diff)
downloadruby-4394e19fddbfafb762fc6bd427e68370d41a0cee.tar.gz
* lib/net/imap.rb (Net::IMAP::PlainAuthenticator): added a new class
to support the PLAIN authentication mechanism. Thanks, Benjamin Stiglitz. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/net/imap.rb')
-rw-r--r--lib/net/imap.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/net/imap.rb b/lib/net/imap.rb
index 7886c66fdd..0a992844d4 100644
--- a/lib/net/imap.rb
+++ b/lib/net/imap.rb
@@ -3130,6 +3130,22 @@ module Net
end
add_authenticator "LOGIN", LoginAuthenticator
+ # Authenticator for the "PLAIN" authentication type. See
+ # #authenticate().
+ class PlainAuthenticator
+ def process(data)
+ return "\0#{@user}\0#{@password}"
+ end
+
+ private
+
+ def initialize(user, password)
+ @user = user
+ @password = password
+ end
+ end
+ add_authenticator "PLAIN", PlainAuthenticator
+
# Authenticator for the "CRAM-MD5" authentication type. See
# #authenticate().
class CramMD5Authenticator