Class: Net::IMAP::SASL::AnonymousAuthenticator
| Relationships & Source Files | |
| Inherits: | Object | 
| Defined in: | lib/net/imap/sasl/anonymous_authenticator.rb | 
Overview
Authenticator for the “ANONYMOUS” ::Net::IMAP::SASL mechanism, as specified by RFC-4505.  See Net::IMAP#authenticate.
Class Method Summary
- 
    
      .new(anonymous_message = "", **)  ⇒ authenticator 
    
    constructor
    Creates an Authenticator for the “ ANONYMOUS”::Net::IMAP::SASLmechanism, as specified in RFC-4505.
Instance Attribute Summary
- 
    
      #anonymous_message  
    
    readonly
    An optional token sent for the ANONYMOUSmechanism., up to 255 UTF-8 characters in length.
- 
    
      #done?  ⇒ Boolean 
    
    readonly
    Returns true when the initial client response was sent. 
- 
    
      #initial_response?  ⇒ Boolean 
    
    readonly
    ANONYMOUScan send an initial client response.
Instance Method Summary
Constructor Details
    
      .new(anonymous_message = "", **)  ⇒ authenticator 
      .new(anonymous_message:  "", **)  ⇒ authenticator 
    
  
Creates an Authenticator for the “ANONYMOUS” ::Net::IMAP::SASL mechanism, as specified in RFC-4505.  To use this, see Net::IMAP#authenticate or your client’s authentication method.
Parameters
- 
optional #anonymous_message — a message to send to the server. 
Any other keyword arguments are silently ignored.
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 37
def initialize(anon_msg = nil, anonymous_message: nil, **) = ( || anon_msg || "").to_str @anonymous_message = StringPrep::Trace.stringprep_trace if (size = @anonymous_message&.length)&.> 255 raise ArgumentError, "anonymous_message is too long. (%d codepoints)" % [size] end @done = false end
Instance Attribute Details
#anonymous_message (readonly)
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 ::Net::IMAP::StringPrep::Trace profile.
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 21
attr_reader :
    #done?  ⇒ Boolean  (readonly)
  
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 'lib/net/imap/sasl/anonymous_authenticator.rb', line 64
def done?; @done end
    #initial_response?  ⇒ Boolean  (readonly)  
ANONYMOUS can send an initial client response.
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 51
def initial_response?; true end
Instance Method Details
#process(_server_challenge_string)
Returns #anonymous_message.
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 54
def process(_server_challenge_string) ensure @done = true end