blib/lib/LWP/Authen/OAuth2/ServiceProvider/Line.pm untested

filter: Statementstmt 0.0% 0 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 6 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 10 totaltotal 0.0% 0 / 63 SCAR 17.9
CC
2
Cov
0%
access_token_class
6.0
required_init
2.0
authorization_required_params
2.0
CRAP 6.0
1 package LWP::Authen::OAuth2::ServiceProvider::Line;
2  
3 # ABSTRACT: Access Line OAuth2 API v2
4 our $VERSION = '0.19'; # VERSION
5  
6 use strict;
7 use warnings;
8  
9 use parent 'LWP::Authen::OAuth2::ServiceProvider';
10  
11 sub required_init {
12 return qw(client_id client_secret redirect_uri);
13 }
14  
15 sub authorization_required_params {
16 return qw(client_id redirect_uri response_type state);
17 }
18  
19 sub authorization_default_params {
20 return response_type => 'code';
21 }
22  
23 sub request_required_params {
24 return qw(client_id redirect_uri grant_type client_secret code);
25 }
26  
27 sub request_default_params {
28 return grant_type => 'authorization_code';
29 }
30  
31 sub init {
32 my ($self, $opts) = @_;
33 $self->copy_option($opts, line_server => 'line.me');
34 $self->SUPER::init($opts);
35 }
36  
37 sub authorization_endpoint {
38 my $self = shift;
39 my $server = $self->{line_server} or die 'line_server not configured. Forgot to call init()?';
40  
41 return "https://access.$server/dialog/oauth/weblogin";
42 }
43  
44 sub token_endpoint {
45 my $self = shift;
46 my $server = $self->{line_server} or die 'line_server not configured. Forgot to call init()?';
47  
48 return "https://api.$server/v2/oauth/accessToken";
49 }
50  
51 sub api_url_base {
52 my $self = shift;
53 my $server = $self->{line_server} or die 'line_server not configured. Forgot to call init()?';
54  
55 return "https://api.$server/v2/";
56 }
57  
58 sub access_token_class {
59 my ($self, $type) = @_;
60  
61 if ($type eq 'bearer') {
62 return 'LWP::Authen::OAuth2::ServiceProvider::Line::AccessToken';
63 }
64  
65 return $self->SUPER::access_token_class($type);
66 }
67  
68  
69 1;
70  
71 __END__