lib/LWP/Authen/OAuth2/ServiceProvider/Google.pm

filter: Statementstmt 68.1% 30 / 44 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.8% 11 / 19 Podpod 60.0% 3 / 5 totaltotal 64.2% 45 / 70 SCAR 7.6
CC
2
Cov
67%
client_type_class
2.3
init
2.0
init
2.0
CRAP 2.1
« lib/LWP/Authen/OAuth2/ServiceProvider/Dwolla.pm ↑ Summary blib/lib/LWP/Authen/OAuth2/ServiceProvider/Strava.pm »
1 package LWP::Authen::OAuth2::ServiceProvider::Google;
2  
3 # ABSTRACT: Google OAuth2
4 2 our $VERSION = '0.19'; # 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 sub authorization_endpoint {
12 1 ▶ return "https://accounts.google.com/o/oauth2/auth";
Subroutine authorization_endpoint: called CC=1 SCAR=0.0
Pod documented
13 }
14  
15 sub token_endpoint {
16 1 ▶ return "https://accounts.google.com/o/oauth2/token";
Subroutine token_endpoint: called CC=1 SCAR=0.0
Pod documented
17 }
18  
19 sub authorization_required_params {
20 1 ▶ my $self = shift;
Subroutine authorization_required_params: called CC=1 SCAR=0.0
Pod undocumented
21 1 return ("scope", $self->SUPER::authorization_required_params());
22 }
23  
24 sub authorization_optional_params {
25 1 ▶ my $self = shift;
Subroutine authorization_optional_params: called CC=1 SCAR=0.0
Pod undocumented
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 sub client_type_class {
40 1 ▶ my ($class, $client_type) = @_;
Subroutine client_type_class: called CC=2 SCAR=8.4
Pod documented
41 1 ▶ if (exists $client_type_class{$client_type}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $client_type_class{$client_type}) { } 1 0 1
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 sub init {
54 0 ▶ Carp::confess(__PACKAGE__ . " is not implemented.");
Subroutine init: not called CC=1 SCAR=6.9
55 }
56  
57 package LWP::Authen::OAuth2::ServiceProvider::Google::Installed;
58 2 our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider::Google);
59  
60 sub init {
61 0 ▶ Carp::confess(__PACKAGE__ . " is not implemented.");
Subroutine init: not called CC=1 SCAR=6.9
62 }
63  
64 package LWP::Authen::OAuth2::ServiceProvider::Google::Login;
65 2 our @ISA = qw(LWP::Authen::OAuth2::ServiceProvider::Google);
66  
67 sub init {
68 0 ▶ Carp::confess(__PACKAGE__ . " is not implemented.");
Subroutine init: not called CC=1 SCAR=6.9
69 }
70  
71 sub authorization_required_params {
72 0 ▶ my $self = shift;
Subroutine authorization_required_params: not called CC=1 SCAR=6.9
73 0 return ("state", $self->SUPER::authorization_required_params());
74 }
75  
76 sub authorization_default_params {
77 0 ▶ my $self = shift;
Subroutine authorization_default_params: not called CC=1 SCAR=6.9
78 return (
79 0 "scope" => "openid email",
80 $self->SUPER::authorization_default_params()
81 );
82 }
83  
84 sub request_required_params {
85 0 ▶ my $self = shift;
Subroutine request_required_params: not called CC=1 SCAR=6.9
86 0 return ("state", $self->SUPER::request_required_params());
87 }
88  
89 sub request_default_params {
90 0 ▶ my $self = shift;
Subroutine request_default_params: not called CC=1 SCAR=6.9
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 sub init {
101 0 ▶ Carp::confess(__PACKAGE__ . " is not implemented.");
Subroutine init: not called CC=1 SCAR=6.9
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 sub required_init {
109 1 ▶ return ();
Subroutine required_init: called CC=1 SCAR=0.0
110 }
111  
112 sub optional_init {
113 1 ▶ return qw(redirect_uri scope client_id client_secret);
Subroutine optional_init: called CC=1 SCAR=0.0
114 }
115  
116 sub authorization_optional_params {
117 1 ▶ my $self = shift;
Subroutine authorization_optional_params: called CC=1 SCAR=0.0
118 return (
119 1 "access_type", "approval_prompt",
120 $self->SUPER::authorization_optional_params()
121 );
122 }
123  
124 sub request_required_params {
125 1 ▶ my $self = shift;
Subroutine request_required_params: called CC=1 SCAR=0.0
126 1 return ("redirect_uri", $self->SUPER::request_required_params());
127 }
128  
129  
130 2 1;
131  
132 __END__
« lib/LWP/Authen/OAuth2/ServiceProvider/Dwolla.pm ↑ Summary blib/lib/LWP/Authen/OAuth2/ServiceProvider/Strava.pm »