class Net::IMAP::SASL::AnonymousAuthenticator

Authenticator for the “ANONYMOUSSASL mechanism, as specified by RFC-4505. See Net::IMAP#authenticate.

Attributes

anonymous_message[R]

An optional token sent for the ANONYMOUS mechanism., up to 255 UTF-8 characters in length.

If it contains an “@” sign, the message must be a valid email address (addr-spec from RFC-2822). Email syntax is not validated by AnonymousAuthenticator.

Otherwise, it can be any UTF8 string which is permitted by the StringPrep::Trace profile.

Public Class Methods

new(anonymous_message = "", **) → authenticator click to toggle source
new(anonymous_message: "", **) → authenticator

Creates an Authenticator for the “ANONYMOUSSASL mechanism, as specified in RFC-4505. To use this, see Net::IMAP#authenticate or your client’s authentication method.

Parameters

Any other keyword arguments are silently ignored.

# File net-imap-0.4.9.1/lib/net/imap/sasl/anonymous_authenticator.rb, line 37
def initialize(anon_msg = nil, anonymous_message: nil, **)
  message = (anonymous_message || anon_msg || "").to_str
  @anonymous_message = StringPrep::Trace.stringprep_trace message
  if (size = @anonymous_message&.length)&.> 255
    raise ArgumentError,
          "anonymous_message is too long.  (%d codepoints)" % [size]
  end
  @done = false
end

Public Instance Methods

done?() click to toggle source

Returns true when the initial client response was sent.

The authentication should not succeed unless this returns true, but it does not indicate success.

# File net-imap-0.4.9.1/lib/net/imap/sasl/anonymous_authenticator.rb, line 64
def done?; @done end
initial_response? → true click to toggle source

ANONYMOUS can send an initial client response.

# File net-imap-0.4.9.1/lib/net/imap/sasl/anonymous_authenticator.rb, line 51
def initial_response?; true end
process(_server_challenge_string) click to toggle source

Returns anonymous_message.

# File net-imap-0.4.9.1/lib/net/imap/sasl/anonymous_authenticator.rb, line 54
def process(_server_challenge_string)
  anonymous_message
ensure
  @done = true
end