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