Class: Net::IMAP::SASL::AnonymousAuthenticator
- Inherits:
-
Object
- Object
- Net::IMAP::SASL::AnonymousAuthenticator
- Defined in:
- lib/net/imap/sasl/anonymous_authenticator.rb
Overview
Authenticator for the “ANONYMOUS
” SASL mechanism, as specified by RFC-4505. See Net::IMAP#authenticate.
Instance Attribute Summary collapse
-
#anonymous_message ⇒ Object
readonly
An optional token sent for the
ANONYMOUS
mechanism., up to 255 UTF-8 characters in length.
Instance Method Summary collapse
-
#done? ⇒ Boolean
Returns true when the initial client response was sent.
-
#initial_response? ⇒ Boolean
:call-seq: initial_response? -> true.
-
#initialize(anon_msg = nil, anonymous_message: nil) ⇒ AnonymousAuthenticator
constructor
:call-seq: new(anonymous_message = “”, **) -> authenticator new(anonymous_message: “”, **) -> authenticator.
-
#process(_server_challenge_string) ⇒ Object
Returns #anonymous_message.
Constructor Details
#initialize(anon_msg = nil, anonymous_message: nil) ⇒ AnonymousAuthenticator
:call-seq:
new(anonymous_message = "", **) -> authenticator
new(anonymous_message: "", **) -> authenticator
Creates an Authenticator for the “ANONYMOUS
” SASL mechanism, as specified in RFC-4505. To use this, see Net::IMAP#authenticate or your client’s authentication method.
#anonymous_message is an optional message which is sent to the server. It may be sent as a positional argument or as a keyword argument.
Any other keyword arguments are silently ignored.
36 37 38 39 40 41 42 43 44 |
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 36 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 ⇒ Object (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 StringPrep::Trace profile.
21 22 23 |
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 21 def @anonymous_message end |
Instance Method Details
#done? ⇒ Boolean
Returns true when the initial client response was sent.
The authentication should not succeed unless this returns true, but it does not indicate success.
63 |
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 63 def done?; @done end |
#initial_response? ⇒ Boolean
:call-seq:
initial_response? -> true
ANONYMOUS
can send an initial client response.
50 |
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 50 def initial_response?; true end |
#process(_server_challenge_string) ⇒ Object
Returns #anonymous_message.
53 54 55 56 57 |
# File 'lib/net/imap/sasl/anonymous_authenticator.rb', line 53 def process(_server_challenge_string) ensure @done = true end |