mirror of
https://github.com/ruby/ruby.git
synced 2025-09-23 20:44:00 +02:00
[ruby/net-imap] Update AUTH=PLAIN to be a little closer to RFC4616
* Add authzid support
* must not contain NULL chars
* improve rdoc
a587fc71b7
This commit is contained in:
parent
331005812f
commit
912f39b2c3
2 changed files with 41 additions and 3 deletions
23
test/net/imap/test_imap_authenticators.rb
Normal file
23
test/net/imap/test_imap_authenticators.rb
Normal file
|
@ -0,0 +1,23 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "net/imap"
|
||||
require "test/unit"
|
||||
|
||||
class IMAPAuthenticatorsTest < Test::Unit::TestCase
|
||||
|
||||
PLAIN = Net::IMAP::PlainAuthenticator
|
||||
|
||||
def test_plain
|
||||
assert_equal("\0authc\0passwd",
|
||||
PLAIN.new("authc", "passwd").process(nil))
|
||||
assert_equal("authz\0user\0pass",
|
||||
PLAIN.new("user", "pass", authzid: "authz").process(nil))
|
||||
end
|
||||
|
||||
def test_plain_no_null_chars
|
||||
assert_raise(ArgumentError) { PLAIN.new("bad\0user", "pass") }
|
||||
assert_raise(ArgumentError) { PLAIN.new("user", "bad\0pass") }
|
||||
assert_raise(ArgumentError) { PLAIN.new("u", "p", authzid: "bad\0authz") }
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue