line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package LWP::Authen::OAuth2::ServiceProvider::Line::AccessToken; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Line AccessToken |
4
|
|
|
|
|
|
|
our $VERSION = '0.18'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
58756
|
use strict; |
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
24
|
|
7
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
8
|
1
|
|
|
1
|
|
391
|
use parent 'LWP::Authen::OAuth2::AccessToken::Bearer'; |
|
1
|
|
|
|
|
236
|
|
|
1
|
|
|
|
|
5
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $REFRESH_PERIOD = 864000; # 10 days. https://devdocs.line.me/en/#refreshing-access-tokens |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Line tokens can be refreshed until the refresh period is over. |
13
|
|
|
|
|
|
|
sub should_refresh { |
14
|
4
|
|
|
4
|
1
|
17
|
my ($self, @args) = @_; |
15
|
|
|
|
|
|
|
|
16
|
4
|
100
|
|
|
|
16
|
return 0 unless $self->SUPER::should_refresh(@args); |
17
|
|
|
|
|
|
|
|
18
|
3
|
|
|
|
|
8
|
my $refresh_expires_time = $self->expires_time + $REFRESH_PERIOD; |
19
|
3
|
|
|
|
|
6
|
my $refresh_token_valid = time < $refresh_expires_time; |
20
|
|
|
|
|
|
|
|
21
|
3
|
|
|
|
|
10
|
return $refresh_token_valid; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# These are exposed for use with /oauth/verify and /oauth/revoke API requests |
25
|
1
|
|
|
1
|
0
|
462
|
sub access_token { shift->{access_token} } |
26
|
1
|
|
|
1
|
0
|
4
|
sub refresh_token { shift->{refresh_token} } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
1; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
__END__ |