From ba4d8f7eba8e548af80ae72fa42ab82fad4fa009 Mon Sep 17 00:00:00 2001 From: Steve Holme Date: Sat, 14 Nov 2015 11:16:04 +0000 Subject: [PATCH] tests: Added OAuth 2.0 (OAUTHBEARER) tests --- tests/data/Makefile.inc | 6 ++--- tests/data/test842 | 57 ++++++++++++++++++++++++++++++++++++++++ tests/data/test843 | 57 ++++++++++++++++++++++++++++++++++++++++ tests/data/test887 | 58 +++++++++++++++++++++++++++++++++++++++++ tests/data/test888 | 57 ++++++++++++++++++++++++++++++++++++++++ tests/data/test946 | 57 ++++++++++++++++++++++++++++++++++++++++ tests/data/test947 | 56 +++++++++++++++++++++++++++++++++++++++ 7 files changed, 345 insertions(+), 3 deletions(-) create mode 100644 tests/data/test842 create mode 100644 tests/data/test843 create mode 100644 tests/data/test887 create mode 100644 tests/data/test888 create mode 100644 tests/data/test946 create mode 100644 tests/data/test947 diff --git a/tests/data/Makefile.inc b/tests/data/Makefile.inc index bc47b9035..b6ef6c13a 100644 --- a/tests/data/Makefile.inc +++ b/tests/data/Makefile.inc @@ -86,20 +86,20 @@ test800 test801 test802 test803 test804 test805 test806 test807 test808 \ test809 test810 test811 test812 test813 test814 test815 test816 test817 \ test818 test819 test820 test821 test822 test823 test824 test825 test826 \ test827 test828 test829 test830 test831 test832 test833 test834 test835 \ -test836 test837 test838 test839 test840 test841 \ +test836 test837 test838 test839 test840 test841 test842 test843 \ \ test850 test851 test852 test853 test854 test855 test856 test857 test858 \ test859 test860 test861 test862 test863 test864 test865 test866 test867 \ test868 test869 test870 test871 test872 test873 test874 test875 test876 \ test877 test878 test879 test880 test881 test882 test883 test884 test885 \ -test886 \ +test886 test887 test888 \ \ test900 test901 test902 test903 test904 test905 test906 test907 test908 \ test909 test910 test911 test912 test913 test914 test915 test916 test917 \ test918 test919 test920 test921 test922 test923 test924 test925 test926 \ test927 test928 test929 test930 test931 test932 test933 test934 test935 \ test936 test937 test938 test939 test940 test941 test942 test943 test944 \ -test945 \ +test945 test946 test947 \ \ test1000 test1001 test1002 test1003 test1004 test1005 test1006 test1007 \ test1008 test1009 test1010 test1011 test1012 test1013 test1014 test1015 \ diff --git a/tests/data/test842 b/tests/data/test842 new file mode 100644 index 000000000..423335755 --- /dev/null +++ b/tests/data/test842 @@ -0,0 +1,57 @@ + + + +IMAP +SASL +SASL AUTH OAUTH2 +RFC6749 +RFC7628 + + + +# +# Server-side + + +AUTH OAUTHBEARER +REPLY AUTHENTICATE + +REPLY dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== A002 OK AUTHENTICATE completed + + +From: me@somewhere +To: fake@nowhere + +body + +-- + yours sincerely + + + +# +# Client-side + + +imap + + +IMAP OAuth 2.0 (OAUTHBEARER) authentication + + +'imap://%HOSTIP:%IMAPPORT/842/;UID=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM + + + +# +# Verify data after the test has been "shot" + + +A001 CAPABILITY +A002 AUTHENTICATE OAUTHBEARER +dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +A003 SELECT 842 +A004 FETCH 1 BODY[] +A005 LOGOUT + + + diff --git a/tests/data/test843 b/tests/data/test843 new file mode 100644 index 000000000..afaa83645 --- /dev/null +++ b/tests/data/test843 @@ -0,0 +1,57 @@ + + + +IMAP +SASL +SASL AUTH OAUTH2 +SASL-IR +RFC6749 +RFC7628 + + + +# +# Server-side + + +AUTH OAUTHBEARER +CAPA SASL-IR +REPLY AUTHENTICATE A002 OK AUTHENTICATE completed + + +From: me@somewhere +To: fake@nowhere + +body + +-- + yours sincerely + + + +# +# Client-side + + +imap + + +IMAP OAuth 2.0 (OAUTH2BEARER) authentication with initial response + + +'imap://%HOSTIP:%IMAPPORT/843/;UID=1' -u user --oauth2-bearer mF_9.B5f-4.1JqM + + + +# +# Verify data after the test has been "shot" + + +A001 CAPABILITY +A002 AUTHENTICATE OAUTHBEARER dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMwFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +A003 SELECT 843 +A004 FETCH 1 BODY[] +A005 LOGOUT + + + diff --git a/tests/data/test887 b/tests/data/test887 new file mode 100644 index 000000000..92a0e88f0 --- /dev/null +++ b/tests/data/test887 @@ -0,0 +1,58 @@ + + + +POP3 +SASL +SASL AUTH OAUTH2 +RFC1734 +RFC5034 +RFC6749 +RFC7628 + + + +# +# Server-side + + +AUTH OAUTHBEARER +REPLY AUTH + +REPLY dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +OK Login successful + + +From: me@somewhere +To: fake@nowhere + +body + +-- + yours sincerely + + + +# +# Client-side + + +pop3 + + +POP3 OAuth 2.0 (OAUTHBEARER) authentication + + +pop3://%HOSTIP:%POP3PORT/887 -u user --oauth2-bearer mF_9.B5f-4.1JqM + + + +# +# Verify data after the test has been "shot" + + +CAPA +AUTH OAUTHBEARER +dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +RETR 887 +QUIT + + + diff --git a/tests/data/test888 b/tests/data/test888 new file mode 100644 index 000000000..63a9b6ede --- /dev/null +++ b/tests/data/test888 @@ -0,0 +1,57 @@ + + + +POP3 +SASL +SASL AUTH OAUTH2 +SASL-IR +RFC1734 +RFC5034 +RFC6749 +RFC7628 + + + +# +# Server-side + + +AUTH OAUTHBEARER +REPLY AUTH +OK Login successful + + +From: me@somewhere +To: fake@nowhere + +body + +-- + yours sincerely + + + +# +# Client-side + + +pop3 + + +POP3 OAuth 2.0 (OAUTHBEARER) authentication with initial response + + +pop3://%HOSTIP:%POP3PORT/888 -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir + + + +# +# Verify data after the test has been "shot" + + +CAPA +AUTH OAUTHBEARER dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwMQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +RETR 888 +QUIT + + + diff --git a/tests/data/test946 b/tests/data/test946 new file mode 100644 index 000000000..e2677bd5e --- /dev/null +++ b/tests/data/test946 @@ -0,0 +1,57 @@ + + + +SMTP +SASL +SASL AUTH OAUTH2 +RFC4954 +RFC6749 +RFC7628 + + + +# +# Server-side + + +AUTH OAUTHBEARER +REPLY AUTH 334 OAUTH2BEARER supported +REPLY dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== 235 Authenticated + + + +#vi +# Client-side + + +smtp + + +SMTP OAuth 2.0 (OAUTHBEARER) authentication + + +mail body + + +smtp://%HOSTIP:%SMTPPORT/946 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM -T - + + + +# +# Verify data after the test has been "shot" + + +EHLO 946 +AUTH OAUTHBEARER +dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +MAIL FROM: +RCPT TO: +DATA +QUIT + + +mail body +. + + + diff --git a/tests/data/test947 b/tests/data/test947 new file mode 100644 index 000000000..ad7cd78cb --- /dev/null +++ b/tests/data/test947 @@ -0,0 +1,56 @@ + + + +SMTP +SASL +SASL AUTH OAUTH2 +SASL-IR +RFC4954 +RFC6749 +RFC7628 + + + +# +# Server-side + + +AUTH OAUTHBEARER +REPLY AUTH 235 Authenticated + + + +# +# Client-side + + +smtp + + +SMTP OAuth 2.0 authentication (OAUTHBEARER) with initial response + + +mail body + + +smtp://%HOSTIP:%SMTPPORT/947 --mail-rcpt recipient@example.com --mail-from sender@example.com -u user --oauth2-bearer mF_9.B5f-4.1JqM --sasl-ir -T - + + + +# +# Verify data after the test has been "shot" + + +EHLO 947 +AUTH OAUTHBEARER dXNlcj11c2VyAWhvc3Q9MTI3LjAuMC4xAXBvcnQ9OTAwNQFhdXRoPUJlYXJlciBtRl85LkI1Zi00LjFKcU0BAQ== +MAIL FROM: +RCPT TO: +DATA +QUIT + + +mail body +. + + +