aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/Catalyst/Authentication/Credential/AccessToken.pm
diff options
context:
space:
mode:
Diffstat (limited to 'perllib/Catalyst/Authentication/Credential/AccessToken.pm')
-rw-r--r--perllib/Catalyst/Authentication/Credential/AccessToken.pm12
1 files changed, 9 insertions, 3 deletions
diff --git a/perllib/Catalyst/Authentication/Credential/AccessToken.pm b/perllib/Catalyst/Authentication/Credential/AccessToken.pm
index 24398823d..39364ad99 100644
--- a/perllib/Catalyst/Authentication/Credential/AccessToken.pm
+++ b/perllib/Catalyst/Authentication/Credential/AccessToken.pm
@@ -15,12 +15,18 @@ sub new {
return $self;
}
-sub authenticate {
- my ( $self, $c, $realm, $authinfo_ignored ) = @_;
-
+sub get_token {
+ my ($self, $c) = @_;
my $auth_header = $c->req->header('Authorization') || '';
my ($token) = $auth_header =~ /^Bearer (.*)/i;
$token ||= $c->get_param('access_token');
+ return $token;
+}
+
+sub authenticate {
+ my ( $self, $c, $realm, $authinfo_ignored ) = @_;
+
+ my $token = $self->get_token($c);
return unless $token;
my $id;