| 1 | package LWP::Authen::OAuth2::ServiceProvider::Google; | ||||||||||
| 2 | |||||||||||
| 3 | # ABSTRACT: Google OAuth2 | ||||||||||
| 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 | our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider); | |||||||||
| 10 | |||||||||||
| 11 | 1 | ▶ | sub authorization_endpoint { | ||||||||
|
Subroutine
authorization_endpoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 12 | 1 | return "https://accounts.google.com/o/oauth2/auth"; | |||||||||
| 13 | } | ||||||||||
| 14 | |||||||||||
| 15 | 1 | ▶ | sub token_endpoint { | ||||||||
|
Subroutine
token_endpoint: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 16 | 1 | return "https://accounts.google.com/o/oauth2/token"; | |||||||||
| 17 | } | ||||||||||
| 18 | |||||||||||
| 19 | 1 | ▶ | sub authorization_required_params { | ||||||||
|
Subroutine
authorization_required_params: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 20 | 1 | my $self = shift; | |||||||||
| 21 | 1 | return ("scope", $self->SUPER::authorization_required_params()); | |||||||||
| 22 | } | ||||||||||
| 23 | |||||||||||
| 24 | 1 | ▶ | sub authorization_optional_params { | ||||||||
|
Subroutine
authorization_optional_params: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||
| 25 | 1 | my $self = shift; | |||||||||
| 26 | 1 | return ("login_hint", $self->SUPER::authorization_optional_params()); | |||||||||
| 27 | } | ||||||||||
| 28 | |||||||||||
| 29 | 2 | my %client_type_class | |||||||||
| 30 | = ( | ||||||||||
| 31 | default => "WebServer", | ||||||||||
| 32 | device => "Device", | ||||||||||
| 33 | installed => "Installed", | ||||||||||
| 34 | login => "Login", | ||||||||||
| 35 | "web server" => "WebServer", | ||||||||||
| 36 | service => "Service", | ||||||||||
| 37 | ); | ||||||||||
| 38 | |||||||||||
| 39 | 1 | ▶ | sub client_type_class { | ||||||||
|
Subroutine
client_type_class: called CC=2 SCAR=8.4
Pod
documented
| |||||||||||
| 40 | 1 | my ($class, $client_type) = @_; | |||||||||
| 41 | 1 | ▶ | if (exists $client_type_class{$client_type}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 42 | 1 | return "LWP::Authen::OAuth2::ServiceProvider::Google::$client_type_class{$client_type}"; | |||||||||
| 43 | } | ||||||||||
| 44 | else { | ||||||||||
| 45 | 0 | my $allowed = join ", ", sort keys %client_type_class; | |||||||||
| 46 | 0 | Carp::croak("Flow '$client_type' not in: $allowed"); | |||||||||
| 47 | } | ||||||||||
| 48 | } | ||||||||||
| 49 | |||||||||||
| 50 | package LWP::Authen::OAuth2::ServiceProvider::Google::Device; | ||||||||||
| 51 | 2 | our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider::Google); | |||||||||
| 52 | |||||||||||
| 53 | 0 | ▶ | sub init { | ||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
| |||||||||||
| 54 | 0 | Carp::confess(__PACKAGE__ . " is not implemented."); | |||||||||
| 55 | } | ||||||||||
| 56 | |||||||||||
| 57 | package LWP::Authen::OAuth2::ServiceProvider::Google::Installed; | ||||||||||
| 58 | 2 | our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider::Google); | |||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | sub init { | ||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
| |||||||||||
| 61 | 0 | Carp::confess(__PACKAGE__ . " is not implemented."); | |||||||||
| 62 | } | ||||||||||
| 63 | |||||||||||
| 64 | package LWP::Authen::OAuth2::ServiceProvider::Google::Login; | ||||||||||
| 65 | 2 | our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider::Google); | |||||||||
| 66 | |||||||||||
| 67 | 0 | ▶ | sub init { | ||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
| |||||||||||
| 68 | 0 | Carp::confess(__PACKAGE__ . " is not implemented."); | |||||||||
| 69 | } | ||||||||||
| 70 | |||||||||||
| 71 | 0 | ▶ | sub authorization_required_params { | ||||||||
|
Subroutine
authorization_required_params: not called CC=1 SCAR=6.9
| |||||||||||
| 72 | 0 | my $self = shift; | |||||||||
| 73 | 0 | return ("state", $self->SUPER::authorization_required_params()); | |||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | 0 | ▶ | sub authorization_default_params { | ||||||||
|
Subroutine
authorization_default_params: not called CC=1 SCAR=6.9
| |||||||||||
| 77 | 0 | my $self = shift; | |||||||||
| 78 | return ( | ||||||||||
| 79 | 0 | "scope" => "openid email", | |||||||||
| 80 | $self->SUPER::authorization_default_params() | ||||||||||
| 81 | ); | ||||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | 0 | ▶ | sub request_required_params { | ||||||||
|
Subroutine
request_required_params: not called CC=1 SCAR=6.9
| |||||||||||
| 85 | 0 | my $self = shift; | |||||||||
| 86 | 0 | return ("state", $self->SUPER::request_required_params()); | |||||||||
| 87 | } | ||||||||||
| 88 | |||||||||||
| 89 | 0 | ▶ | sub request_default_params { | ||||||||
|
Subroutine
request_default_params: not called CC=1 SCAR=6.9
| |||||||||||
| 90 | 0 | my $self = shift; | |||||||||
| 91 | return ( | ||||||||||
| 92 | 0 | "scope" => "openid email", | |||||||||
| 93 | $self->SUPER::request_default_params() | ||||||||||
| 94 | ); | ||||||||||
| 95 | } | ||||||||||
| 96 | |||||||||||
| 97 | package LWP::Authen::OAuth2::ServiceProvider::Google::Service; | ||||||||||
| 98 | 2 | our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider::Google); | |||||||||
| 99 | |||||||||||
| 100 | 0 | ▶ | sub init { | ||||||||
|
Subroutine
init: not called CC=1 SCAR=6.9
| |||||||||||
| 101 | 0 | Carp::confess(__PACKAGE__ . " is not implemented."); | |||||||||
| 102 | } | ||||||||||
| 103 | |||||||||||
| 104 | package LWP::Authen::OAuth2::ServiceProvider::Google::WebServer; | ||||||||||
| 105 | 2 | our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider::Google); | |||||||||
| 106 | |||||||||||
| 107 | # Not guaranteed a refresh token, so require nothing. | ||||||||||
| 108 | 1 | ▶ | sub required_init { | ||||||||
|
Subroutine
required_init: called CC=1 SCAR=0.0
| |||||||||||
| 109 | 1 | return (); | |||||||||
| 110 | } | ||||||||||
| 111 | |||||||||||
| 112 | 1 | ▶ | sub optional_init { | ||||||||
|
Subroutine
optional_init: called CC=1 SCAR=0.0
| |||||||||||
| 113 | 1 | return qw(redirect_uri scope client_id client_secret); | |||||||||
| 114 | } | ||||||||||
| 115 | |||||||||||
| 116 | 1 | ▶ | sub authorization_optional_params { | ||||||||
|
Subroutine
authorization_optional_params: called CC=1 SCAR=0.0
| |||||||||||
| 117 | 1 | my $self = shift; | |||||||||
| 118 | return ( | ||||||||||
| 119 | 1 | "access_type", "approval_prompt", | |||||||||
| 120 | $self->SUPER::authorization_optional_params() | ||||||||||
| 121 | ); | ||||||||||
| 122 | } | ||||||||||
| 123 | |||||||||||
| 124 | 1 | ▶ | sub request_required_params { | ||||||||
|
Subroutine
request_required_params: called CC=1 SCAR=0.0
| |||||||||||
| 125 | 1 | my $self = shift; | |||||||||
| 126 | 1 | return ("redirect_uri", $self->SUPER::request_required_params()); | |||||||||
| 127 | } | ||||||||||
| 128 | |||||||||||
| 129 | |||||||||||
| 130 | 2 | 1; | |||||||||
| 131 | |||||||||||
| 132 | __END__ | ||||||||||