line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CatalystX::OAuth2::Client; |
2
|
2
|
|
|
2
|
|
14
|
use Moose; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
16
|
|
3
|
2
|
|
|
2
|
|
13246
|
use LWP::UserAgent; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
312
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# ABSTRACT: An http client for requesting oauth2-protected resources using a token |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $UA; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has token => ( isa => 'Str', is => 'rw', required => 1 ); |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
33
|
1
|
0
|
13
|
sub ua { $UA ||= LWP::UserAgent->new }; |
12
|
|
|
|
|
|
|
sub request { shift->ua->request(@_) } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
before request => sub { |
15
|
|
|
|
|
|
|
my($self, $req) = @_; |
16
|
|
|
|
|
|
|
my $token = $self->token; |
17
|
|
|
|
|
|
|
$req->header( Authorization => 'Bearer ' . $token ); |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
1; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
__END__ |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=pod |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 NAME |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
CatalystX::OAuth2::Client - An http client for requesting oauth2-protected resources using a token |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 VERSION |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
version 0.001006 |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head1 AUTHOR |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Eden Cardim <edencardim@gmail.com> |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Suretec Systems Ltd. |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
43
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |