class Net::SASL::PlainAuthenticator

Authenticator for the “PLAINSASL mechanism, specified in RFC4616. The authentication credentials are transmitted in cleartext, so this mechanism should only be used over an encrypted link.

Constants

NULL

Attributes

authzid[R]
done[R]
done?[R]
password[R]
username[R]

Public Class Methods

new(username, password, authzid = nil, **_options) click to toggle source

username is the authentication identity, the identity whose password is used. username is referred to as authcid by RFC4616.

authzid is the authorization identity (identity to act as). It can usually be left blank. When authzid is left blank (nil or empty string) the server will derive an identity from the credentials and use that as the authorization identity.

This should generally be instantiated via Net::SASL.authenticator.

Calls superclass method Net::SASL::Authenticator::new
# File lib/net/sasl/plain_authenticator.rb, line 31
def initialize(username, password, authzid = nil, **_options)
  raise ArgumentError, "username contains NULL" if username&.include?(NULL)
  raise ArgumentError, "password contains NULL" if password&.include?(NULL)
  raise ArgumentError, "authzid  contains NULL" if authzid&.include?(NULL)
  super
  @done = false
end

Public Instance Methods

process(data) click to toggle source

returns the SASL response for PLAIN

# File lib/net/sasl/plain_authenticator.rb, line 45
def process(data)
  @done = true
  "#{@authzid}\0#{@username}\0#{@password}"
end
supports_initial_response?() click to toggle source

PLAIN does support SASL-IR

# File lib/net/sasl/plain_authenticator.rb, line 40
def supports_initial_response?
  true
end