summaryrefslogtreecommitdiff
path: root/lib/Authen/SASL/Perl/XOAUTH2.pm
diff options
context:
space:
mode:
authorGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2023-09-12 11:28:38 +0100
committerGianni Ceccarelli <gianni.ceccarelli@broadbean.com>2023-09-12 11:28:38 +0100
commita5bdd39f6783aba7570fdbdaf48158b68b88cc9f (patch)
tree33f0121c5e4a6b683381ce5f67ebd6f5beddcef4 /lib/Authen/SASL/Perl/XOAUTH2.pm
parentdrop deprecated ::Transport::SMTPS (diff)
downloadconfig-clawsmail-a5bdd39f6783aba7570fdbdaf48158b68b88cc9f.tar.gz
config-clawsmail-a5bdd39f6783aba7570fdbdaf48158b68b88cc9f.tar.bz2
config-clawsmail-a5bdd39f6783aba7570fdbdaf48158b68b88cc9f.zip
add XOAUTH2 support
Diffstat (limited to 'lib/Authen/SASL/Perl/XOAUTH2.pm')
-rw-r--r--lib/Authen/SASL/Perl/XOAUTH2.pm23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/Authen/SASL/Perl/XOAUTH2.pm b/lib/Authen/SASL/Perl/XOAUTH2.pm
new file mode 100644
index 0000000..2cabcd4
--- /dev/null
+++ b/lib/Authen/SASL/Perl/XOAUTH2.pm
@@ -0,0 +1,23 @@
+package Authen::SASL::Perl::XOAUTH2;
+use strict;
+use warnings;
+use 5.020;
+use parent 'Authen::SASL::Perl';
+
+sub _order { 10 }
+
+sub mechanism { 'XOAUTH2' }
+
+sub client_start { '' }
+
+sub client_step {
+ my ($self, $string) = @_;
+ my ($username, $token) = map {
+ my $v = $self->_call($_);
+ defined($v) ? $v : ''
+ } qw(user pass);
+
+ "user=${username}\cAauth=Bearer $token\cA\cA",
+}
+
+1;