-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Support aliases in dummy connector (#5)
Aliases are different usernames which are associated with the same backend account. For instance, a user might have two aliases on their account, `[email protected]` and `[email protected]`. In this case, their IMAP client would be able to login with either of these addresses as the username and it would connect to the same backend IMAP account. This feature allows Bridge to support Proton accounts with multiple addresses.
- Loading branch information
1 parent
2ec2361
commit f9a3ea4
Showing
7 changed files
with
74 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ func main() { | |
server := gluon.New(filepath.Join(dir, "server")) | ||
|
||
connector := connector.NewDummy( | ||
"[email protected]", | ||
[]string{"[email protected]", "[email protected]"}, | ||
"password", | ||
time.Second, | ||
imap.NewFlagSet(), | ||
|
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 |
---|---|---|
|
@@ -28,7 +28,10 @@ func TestLoginLiteral(t *testing.T) { | |
} | ||
|
||
func TestLoginMultiple(t *testing.T) { | ||
runTest(t, map[string]string{"user1": "pass1", "user2": "pass2"}, "/", []int{1, 2}, func(c map[int]*testConnection, _ *testSession) { | ||
runTest(t, []credentials{ | ||
{usernames: []string{"user1"}, password: "pass1"}, | ||
{usernames: []string{"user2"}, password: "pass2"}, | ||
}, "/", []int{1, 2}, func(c map[int]*testConnection, _ *testSession) { | ||
// Login as the first user. | ||
c[1].C("A001 login user1 pass1").OK("A001") | ||
|
||
|
@@ -43,6 +46,25 @@ func TestLoginMultiple(t *testing.T) { | |
}) | ||
} | ||
|
||
func TestLoginAlias(t *testing.T) { | ||
runTest(t, []credentials{{ | ||
usernames: []string{"alias1", "alias2"}, | ||
password: "pass", | ||
}}, "/", []int{1, 2}, func(c map[int]*testConnection, _ *testSession) { | ||
// Login as each alias. | ||
c[1].C("tag1 login alias1 pass").OK("tag1") | ||
c[2].C("tag2 login alias2 pass").OK("tag2") | ||
|
||
// Create a message with each alias. | ||
c[1].C("tag3 append inbox {11}\r\nTo: [email protected]").OK("tag3") | ||
c[2].C("tag4 append inbox {11}\r\nTo: [email protected]").OK("tag4") | ||
|
||
// Both messages should be visible to both clients. | ||
c[1].C("tag5 status inbox (messages)").Sx("MESSAGES 2").OK("tag5") | ||
c[2].C("tag6 status inbox (messages)").Sx("MESSAGES 2").OK("tag6") | ||
}) | ||
} | ||
|
||
func TestLoginFailure(t *testing.T) { | ||
runOneToOneTest(t, "user", "pass", "/", func(c *testConnection, _ *testSession) { | ||
c.C("A001 login baduser badpass").NO("A001") | ||
|
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