diff options
Diffstat (limited to 'lib/net/imap/authenticators/plain.rb')
-rw-r--r-- | lib/net/imap/authenticators/plain.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/net/imap/authenticators/plain.rb b/lib/net/imap/authenticators/plain.rb new file mode 100644 index 0000000000..0829476c51 --- /dev/null +++ b/lib/net/imap/authenticators/plain.rb @@ -0,0 +1,19 @@ +# frozen_string_literal: true + +# Authenticator for the "+PLAIN+" SASL mechanism. See Net::IMAP#authenticate. +# +# See RFC4616[https://tools.ietf.org/html/rfc4616] for the specification. +class Net::IMAP::PlainAuthenticator + def process(data) + return "\0#{@user}\0#{@password}" + end + + private + + def initialize(user, password) + @user = user + @password = password + end + + Net::IMAP.add_authenticator "PLAIN", self +end |