summaryrefslogtreecommitdiff
path: root/lib/Authen/SASL/Perl/XOAUTH2.pm
diff options
context:
space:
mode:
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;