net-imap 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/net/imap/authenticators.rb +30 -10
- data/lib/net/imap/flags.rb +1 -0
- data/lib/net/imap/sasl/stringprep.rb +6 -2
- data/lib/net/imap.rb +979 -257
- data/rakelib/rfcs.rake +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7942e0dcda47ac417806fb03aec58b66b8bac3ccf51f53f2f7ac2c6a588e35af
|
4
|
+
data.tar.gz: 38530b6af862085a9d1ff3c59c6536152acc15bb7d925d8547cd4feebea42872
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5bd29fb28b2b3ed9b1a0589e38f8844c47e671006d50deb4462fe5e8cfd97ad923ef0af3114a094d31cbb5943ff0ac9a15e549e67ac08be68eb04a0915eae67f
|
7
|
+
data.tar.gz: 7562e44288caa3538203d415f4d0b1dc4a44a77428e40c4b44046b86fb26b1abc2a4226229f4f494e54f21240cc96dea9106afded971829ec5873f507adab7c9
|
@@ -3,22 +3,42 @@
|
|
3
3
|
# Registry for SASL authenticators used by Net::IMAP.
|
4
4
|
module Net::IMAP::Authenticators
|
5
5
|
|
6
|
-
# Adds an authenticator for
|
6
|
+
# Adds an authenticator for Net::IMAP#authenticate to use. +mechanism+ is the
|
7
7
|
# {SASL mechanism}[https://www.iana.org/assignments/sasl-mechanisms/sasl-mechanisms.xhtml]
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
8
|
+
# implemented by +authenticator+ (for instance, <tt>"PLAIN"</tt>).
|
9
|
+
#
|
10
|
+
# The +authenticator+ must respond to +#new+ (or #call), receiving the
|
11
|
+
# authenticator configuration and return a configured authentication session.
|
12
|
+
# The authenticator session must respond to +#process+, receiving the server's
|
13
|
+
# challenge and returning the client's response.
|
13
14
|
#
|
14
|
-
#
|
15
|
-
#
|
15
|
+
# See PlainAuthenticator, XOauth2Authenticator, and DigestMD5Authenticator for
|
16
|
+
# examples.
|
16
17
|
def add_authenticator(auth_type, authenticator)
|
17
18
|
authenticators[auth_type] = authenticator
|
18
19
|
end
|
19
20
|
|
20
|
-
#
|
21
|
-
#
|
21
|
+
# :call-seq:
|
22
|
+
# authenticator(mechanism, ...) -> authenticator
|
23
|
+
# authenticator(mech, *creds, **props) {|prop, auth| val } -> authenticator
|
24
|
+
# authenticator(mechanism, authnid, creds, authzid=nil) -> authenticator
|
25
|
+
# authenticator(mechanism, **properties) -> authenticator
|
26
|
+
# authenticator(mechanism) {|propname, authctx| value } -> authenticator
|
27
|
+
#
|
28
|
+
# Builds a new authentication session context for +mechanism+.
|
29
|
+
#
|
30
|
+
# [Note]
|
31
|
+
# This method is intended for internal use by connection protocol code only.
|
32
|
+
# Protocol client users should see refer to their client's documentation,
|
33
|
+
# e.g. Net::IMAP#authenticate for Net::IMAP.
|
34
|
+
#
|
35
|
+
# The call signatures documented for this method are recommendations for
|
36
|
+
# authenticator implementors. All arguments (other than +mechanism+) are
|
37
|
+
# forwarded to the registered authenticator's +#new+ (or +#call+) method, and
|
38
|
+
# each authenticator must document its own arguments.
|
39
|
+
#
|
40
|
+
# The returned object represents a single authentication exchange and <em>must
|
41
|
+
# not</em> be reused for multiple authentication attempts.
|
22
42
|
def authenticator(mechanism, *authargs, **properties, &callback)
|
23
43
|
authenticator = authenticators.fetch(mechanism.upcase) do
|
24
44
|
raise ArgumentError, 'unknown auth type - "%s"' % mechanism
|
data/lib/net/imap/flags.rb
CHANGED
@@ -26,6 +26,9 @@ module Net::IMAP::SASL
|
|
26
26
|
#
|
27
27
|
# Also checks bidirectional characters, when <tt>bidi: true</tt>, which may
|
28
28
|
# raise a BidiStringError.
|
29
|
+
#
|
30
|
+
# +profile+ is an optional string which will be added to any exception that
|
31
|
+
# is raised (it does not affect behavior).
|
29
32
|
def check_prohibited!(string, *tables, bidi: false, profile: nil)
|
30
33
|
tables = TABLE_TITLES.keys.grep(/^C/) if tables.empty?
|
31
34
|
tables |= %w[C.8] if bidi
|
@@ -47,10 +50,11 @@ module Net::IMAP::SASL
|
|
47
50
|
# RandALCat character MUST be the last character of the string.
|
48
51
|
#
|
49
52
|
# This is usually combined with #check_prohibited!, so table "C.8" is only
|
50
|
-
# checked when
|
53
|
+
# checked when <tt>c_8: true</tt>.
|
51
54
|
#
|
52
55
|
# Raises either ProhibitedCodepoint or BidiStringError unless all
|
53
|
-
# requirements are met.
|
56
|
+
# requirements are met. +profile+ is an optional string which will be
|
57
|
+
# added to any exception that is raised (it does not affect behavior).
|
54
58
|
def check_bidi!(string, c_8: false, profile: nil)
|
55
59
|
check_prohibited!(string, "C.8", profile: profile) if c_8
|
56
60
|
if BIDI_FAILS_REQ2.match?(string)
|