class IMAP::PlainAuthenticator

RFC 2595 PLAIN Authenticator for Net::IMAP. Only for use with SSL (but not enforced).

Public Class Methods

new(user, password) click to toggle source

Creates a new PlainAuthenticator that will authenticate with user and password.

# File lib/imap_sasl_plain.rb, line 30
def initialize(user, password)
  @user = user
  @password = password
end

Public Instance Methods

process(data) click to toggle source

From RFC 2595 Section 6. PLAIN SASL Authentication

The mechanism consists of a single message from the client to the
server.  The client sends the authorization identity (identity to
login as), followed by a US-ASCII NUL character, followed by the
authentication identity (identity whose password will be used),
followed by a US-ASCII NUL character, followed by the clear-text
password.  The client may leave the authorization identity empty to
indicate that it is the same as the authentication identity.
# File lib/imap_sasl_plain.rb, line 20
def process(data)
  return [@user, @user, @password].join("\0")
end