OAuth/Provider/Github.pm

filter: Statementstmt 100% 18 / 18 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 88.8% 24 / 27 CC 2 SCAR 2.9
CC
2
Cov
95%
post_process
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.3
« OAuth/Provider/Linkedin.pm ↑ Summary OAuth/Provider/Google.pm »
1 package Dancer2::Plugin::Auth::OAuth::Provider::Github;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use parent 'Dancer2::Plugin::Auth::OAuth::Provider';
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use HTTP::Request::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 3 ▶sub config { {
Subroutine config: called CC=1 SCAR=0.0
Pod undocumented
9 3 urls => {
10 access_token_url => "https://github.com/login/oauth/access_token",
11 authorize_url => "https://github.com/login/oauth/authorize",
12 user_info => "https://api.github.com/user",
13 }
14 } }
15  
16 1 ▶sub post_process {
Subroutine post_process: called CC=2 SCAR=7.0
Pod undocumented
17 1 my ($self, $session) = @_;
18  
19 1 my $session_data = $session->read('oauth');
20  
21 my $resp = $self->{ua}->request(
22 GET $self->provider_settings->{urls}{user_info},
23 'Authorization' => 'token '.$session_data->{github}{access_token}
24 1 );
25  
26 1 ▶ if( $resp->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($resp->is_success) 1 0 1
27 1 my $user = $self->_stringify_json_booleans(
28 JSON::MaybeXS::decode_json( $resp->content )
29 );
30 1 $session_data->{github}{user_info} = $user;
31 1 $session->write('oauth', $session_data);
32 }
33 }
34  
35 1 1;
« OAuth/Provider/Linkedin.pm ↑ Summary OAuth/Provider/Google.pm »