mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
[ruby/net-imap] Clean up authenticators rdoc
Added RFC links to all SASL mechanism specifications.
53ff4b0c09
This commit is contained in:
parent
912f39b2c3
commit
2fc91da86c
5 changed files with 36 additions and 18 deletions
|
@ -3,11 +3,11 @@
|
||||||
# Registry for SASL authenticators used by Net::IMAP.
|
# Registry for SASL authenticators used by Net::IMAP.
|
||||||
module Net::IMAP::Authenticators
|
module Net::IMAP::Authenticators
|
||||||
|
|
||||||
# Adds an authenticator for Net::IMAP#authenticate. +auth_type+ is the
|
# Adds an authenticator for use with Net::IMAP#authenticate. +auth_type+ is the
|
||||||
# {SASL mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
|
# {SASL mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
|
||||||
# supported by +authenticator+ (for instance, "+LOGIN+"). The +authenticator+
|
# supported by +authenticator+ (for instance, "+PLAIN+"). The +authenticator+
|
||||||
# is an object which defines a +#process+ method to handle authentication with
|
# is an object which defines a +#process+ method to handle authentication with
|
||||||
# the server. See Net::IMAP::LoginAuthenticator,
|
# the server. See Net::IMAP::PlainAuthenticator, Net::IMAP::LoginAuthenticator,
|
||||||
# Net::IMAP::CramMD5Authenticator, and Net::IMAP::DigestMD5Authenticator for
|
# Net::IMAP::CramMD5Authenticator, and Net::IMAP::DigestMD5Authenticator for
|
||||||
# examples.
|
# examples.
|
||||||
#
|
#
|
||||||
|
|
|
@ -2,17 +2,19 @@
|
||||||
|
|
||||||
require "digest/md5"
|
require "digest/md5"
|
||||||
|
|
||||||
# Authenticator for the "+CRAM-MD5+" SASL mechanism. See
|
# Authenticator for the "+CRAM-MD5+" SASL mechanism, specified in
|
||||||
# Net::IMAP#authenticate.
|
# RFC2195[https://tools.ietf.org/html/rfc2195]. See Net::IMAP#authenticate.
|
||||||
#
|
#
|
||||||
# == Deprecated
|
# == Deprecated
|
||||||
#
|
#
|
||||||
# +CRAM-MD5+ should be considered obsolete and insecure. It is included for
|
# +CRAM-MD5+ is obsolete and insecure. It is included for compatibility with
|
||||||
# backward compatibility with historic servers.
|
# existing servers.
|
||||||
# {draft-ietf-sasl-crammd5-to-historic}[https://tools.ietf.org/html/draft-ietf-sasl-crammd5-to-historic-00.html]
|
# {draft-ietf-sasl-crammd5-to-historic}[https://tools.ietf.org/html/draft-ietf-sasl-crammd5-to-historic-00.html]
|
||||||
# recommends using +SCRAM-*+ or +PLAIN+ protected by TLS instead. Additionally,
|
# recommends using +SCRAM-*+ or +PLAIN+ protected by TLS instead.
|
||||||
# RFC8314[https://tools.ietf.org/html/rfc8314] discourage the use of cleartext
|
#
|
||||||
# and recommends TLS version 1.2 or greater be used for all traffic.
|
# Additionally, RFC8314[https://tools.ietf.org/html/rfc8314] discourage the use
|
||||||
|
# of cleartext and recommends TLS version 1.2 or greater be used for all
|
||||||
|
# traffic. With TLS +CRAM-MD5+ is okay, but so is +PLAIN+
|
||||||
class Net::IMAP::CramMD5Authenticator
|
class Net::IMAP::CramMD5Authenticator
|
||||||
def process(challenge)
|
def process(challenge)
|
||||||
digest = hmac_md5(challenge, @password)
|
digest = hmac_md5(challenge, @password)
|
||||||
|
|
|
@ -3,14 +3,14 @@
|
||||||
require "digest/md5"
|
require "digest/md5"
|
||||||
require "strscan"
|
require "strscan"
|
||||||
|
|
||||||
# Net::IMAP authenticator for the "`DIGEST-MD5`" SASL mechanism type. See
|
# Net::IMAP authenticator for the "`DIGEST-MD5`" SASL mechanism type, specified
|
||||||
# Net::IMAP#authenticate.
|
# in RFC2831(https://tools.ietf.org/html/rfc2831). See Net::IMAP#authenticate.
|
||||||
#
|
#
|
||||||
# == Deprecated
|
# == Deprecated
|
||||||
#
|
#
|
||||||
# "+DIGEST-MD5+" has been deprecated by
|
# "+DIGEST-MD5+" has been deprecated by
|
||||||
# {RFC6331}[https://tools.ietf.org/html/rfc6331] and should not be used. It
|
# {RFC6331}[https://tools.ietf.org/html/rfc6331] and should not be relied on for
|
||||||
# is included for backward compatibility with historic servers.
|
# security. It is included for compatibility with existing servers.
|
||||||
class Net::IMAP::DigestMD5Authenticator
|
class Net::IMAP::DigestMD5Authenticator
|
||||||
def process(challenge)
|
def process(challenge)
|
||||||
case @stage
|
case @stage
|
||||||
|
|
|
@ -2,12 +2,21 @@
|
||||||
|
|
||||||
# Authenticator for the "+LOGIN+" SASL mechanism. See Net::IMAP#authenticate.
|
# Authenticator for the "+LOGIN+" SASL mechanism. See Net::IMAP#authenticate.
|
||||||
#
|
#
|
||||||
|
# +LOGIN+ authentication sends the password in cleartext.
|
||||||
|
# RFC3501[https://tools.ietf.org/html/rfc3501] encourages servers to disable
|
||||||
|
# cleartext authentication until after TLS has been negotiated.
|
||||||
|
# RFC8314[https://tools.ietf.org/html/rfc8314] recommends TLS version 1.2 or
|
||||||
|
# greater be used for all traffic, and deprecate cleartext access ASAP. +LOGIN+
|
||||||
|
# can be secured by TLS encryption.
|
||||||
|
#
|
||||||
# == Deprecated
|
# == Deprecated
|
||||||
#
|
#
|
||||||
# The {SASL mechanisms
|
# The {SASL mechanisms
|
||||||
# registry}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
|
# registry}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
|
||||||
# marks "LOGIN" as obsoleted in favor of "PLAIN". See also
|
# marks "LOGIN" as obsoleted in favor of "PLAIN". It is included here for
|
||||||
# {draft-murchison-sasl-login}[https://www.iana.org/go/draft-murchison-sasl-login].
|
# compatibility with existing servers. See
|
||||||
|
# {draft-murchison-sasl-login}[https://www.iana.org/go/draft-murchison-sasl-login]
|
||||||
|
# for both specification and deprecation.
|
||||||
class Net::IMAP::LoginAuthenticator
|
class Net::IMAP::LoginAuthenticator
|
||||||
def process(data)
|
def process(data)
|
||||||
case @state
|
case @state
|
||||||
|
|
|
@ -1,14 +1,21 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
# Authenticator for the "+PLAIN+" SASL mechanism. See Net::IMAP#authenticate.
|
# Authenticator for the "+PLAIN+" SASL mechanism, specified in
|
||||||
|
# RFC4616[https://tools.ietf.org/html/rfc4616]. See Net::IMAP#authenticate.
|
||||||
#
|
#
|
||||||
# See RFC4616[https://tools.ietf.org/html/rfc4616] for the specification.
|
# +PLAIN+ authentication sends the password in cleartext.
|
||||||
|
# RFC3501[https://tools.ietf.org/html/rfc3501] encourages servers to disable
|
||||||
|
# cleartext authentication until after TLS has been negotiated.
|
||||||
|
# RFC8314[https://tools.ietf.org/html/rfc8314] recommends TLS version 1.2 or
|
||||||
|
# greater be used for all traffic, and deprecate cleartext access ASAP. +PLAIN+
|
||||||
|
# can be secured by TLS encryption.
|
||||||
class Net::IMAP::PlainAuthenticator
|
class Net::IMAP::PlainAuthenticator
|
||||||
|
|
||||||
def process(data)
|
def process(data)
|
||||||
return "#@authzid\0#@username\0#@password"
|
return "#@authzid\0#@username\0#@password"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# :nodoc:
|
||||||
NULL = -"\0".b
|
NULL = -"\0".b
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue