line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
457
|
use parent 'Dancer2::Plugin::Auth::OAuth::Provider'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
5
|
|
|
|
|
|
|
use HTTP::Request::Common; |
6
|
1
|
|
|
1
|
|
50
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
191
|
|
7
|
|
|
|
|
|
|
urls => { |
8
|
|
|
|
|
|
|
access_token_url => "https://github.com/login/oauth/access_token", |
9
|
3
|
|
|
3
|
0
|
31
|
authorize_url => "https://github.com/login/oauth/authorize", |
10
|
|
|
|
|
|
|
user_info => "https://api.github.com/user", |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
} } |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my ($self, $session) = @_; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
my $session_data = $session->read('oauth'); |
17
|
1
|
|
|
1
|
0
|
3
|
|
18
|
|
|
|
|
|
|
my $resp = $self->{ua}->request( |
19
|
1
|
|
|
|
|
3
|
GET $self->provider_settings->{urls}{user_info}, |
20
|
|
|
|
|
|
|
'Authorization' => 'token '.$session_data->{github}{access_token} |
21
|
|
|
|
|
|
|
); |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
if( $resp->is_success ) { |
24
|
1
|
|
|
|
|
23
|
my $user = $self->_stringify_json_booleans( |
25
|
|
|
|
|
|
|
JSON::MaybeXS::decode_json( $resp->content ) |
26
|
1
|
50
|
|
|
|
441
|
); |
27
|
1
|
|
|
|
|
10
|
$session_data->{github}{user_info} = $user; |
28
|
|
|
|
|
|
|
$session->write('oauth', $session_data); |
29
|
|
|
|
|
|
|
} |
30
|
1
|
|
|
|
|
3
|
} |
31
|
1
|
|
|
|
|
4
|
|
32
|
|
|
|
|
|
|
1; |