class Net::SASL::LoginAuthenticator

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

Deprecated

The SASL mechanisms registry marks “LOGIN” as obsoleted by “PLAIN”. It is included here for compatibility with existing servers. See draft-murchison-sasl-login for both specification and deprecation.

Constants

STATE_DONE
STATE_PASSWORD
STATE_USER

Attributes

password[R]
username[R]

Public Class Methods

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

Provide the username and password credentials for authentication.

LOGIN doesn't support authzid, and an ArgumentError will be raised if a third positional parameter is passed.

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

Calls superclass method Net::SASL::Authenticator::new
# File lib/net/sasl/login_authenticator.rb, line 28
def initialize(username, password, **_options)
  super
  @state = STATE_USER
end

Public Instance Methods

done?() click to toggle source

Returns true after sending the username and password.

# File lib/net/sasl/login_authenticator.rb, line 46
def done?
  @state == STATE_DONE
end
process(data) click to toggle source

returns the SASL response for LOGIN

# File lib/net/sasl/login_authenticator.rb, line 34
def process(data)
  case @state
  when STATE_USER
    @state = STATE_PASSWORD
    @username
  when STATE_PASSWORD
    @state = STATE_DONE
    @password
  end
end