-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔒 Add
secret
alias to relevant SASL mechanisms
`secret` is similar to `username`: a convenient alias with ambiguous semantics. Adding it is reasonable, but I probably wouldn't add it only for `Net::IMAP`. However, `Net::SMTP` uses it, and probably others would find it useful too.
- Loading branch information
Showing
8 changed files
with
46 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -57,6 +57,10 @@ def test_plain_kw_params | |
"zid\0cid\0p", | ||
plain(authcid: "cid", password: "p", authzid: "zid").process(nil) | ||
) | ||
assert_equal( | ||
"zid\0cid\0p", | ||
plain(username: "cid", secret: "p", authzid: "zid").process(nil) | ||
) | ||
end | ||
|
||
def test_plain_username_kw_sets_both_authcid_and_authzid | ||
|
@@ -96,6 +100,15 @@ def test_oauthbearer_response | |
oauthbearer("mF_9.B5f-4.1JqM", authzid: "[email protected]", | ||
host: "server.example.com", port: 587).process(nil) | ||
) | ||
assert_equal( | ||
"n,[email protected],\1host=server.example.com\1port=587\1" \ | ||
"auth=Bearer sssssssss\1\1", | ||
oauthbearer(secret: "sssssssss", username: "[email protected]", | ||
host: "server.example.com", port: 587).process(nil) | ||
) | ||
assert_equal( | ||
"n,a=user,\1auth=Bearer tok\1\1", oauthbearer("user", "tok").process(nil) | ||
) | ||
end | ||
|
||
# ---------------------- | ||
|
@@ -153,6 +166,15 @@ def test_scram_sha1_authenticator | |
assert authenticator.done? | ||
end | ||
|
||
def test_scram_kwargs | ||
authenticator = scram_sha1(authcid: "user", password: "pass") | ||
assert_equal "user", authenticator.authcid | ||
assert_equal "pass", authenticator.password | ||
authenticator = scram_sha1(username: "user", secret: "pass") | ||
assert_equal "user", authenticator.authcid | ||
assert_equal "pass", authenticator.password | ||
end | ||
|
||
def test_scram_sha256_authenticator | ||
authenticator = scram_sha256("user", "pencil", | ||
cnonce: "rOprNGfwEbeRWgbNEkqO") | ||
|
@@ -210,6 +232,10 @@ def test_xoauth2_kwargs | |
"user=user\1auth=Bearer kwarg\1\1", | ||
xoauth2(username: "user", oauth2_token: "kwarg").process(nil) | ||
) | ||
assert_equal( | ||
"user=user\1auth=Bearer kwarg\1\1", | ||
xoauth2(authzid: "user", secret: "kwarg").process(nil) | ||
) | ||
end | ||
|
||
def test_xoauth2_supports_initial_response | ||
|