line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
use strict; |
3
|
1
|
|
|
1
|
|
490
|
use parent 'Dancer2::Plugin::Auth::OAuth::Provider'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
4
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
11
|
|
5
|
|
|
|
|
|
|
use HTTP::Request::Common; |
6
|
1
|
|
|
1
|
|
55
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
251
|
|
7
|
|
|
|
|
|
|
version => 2, |
8
|
|
|
|
|
|
|
urls => { |
9
|
3
|
|
|
3
|
0
|
49
|
authorize_url => 'https://www.facebook.com/dialog/oauth', |
10
|
|
|
|
|
|
|
access_token_url => 'https://graph.facebook.com/oauth/access_token', |
11
|
|
|
|
|
|
|
user_info => 'https://graph.facebook.com/me', |
12
|
|
|
|
|
|
|
}, |
13
|
|
|
|
|
|
|
query_params => { |
14
|
|
|
|
|
|
|
authorize => { |
15
|
|
|
|
|
|
|
response_type => 'code', |
16
|
|
|
|
|
|
|
scope => 'email,public_profile,user_friends', |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} } |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
my ($self, $session) = @_; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $fields = ''; |
24
|
1
|
|
|
1
|
0
|
3
|
if ( exists $self->provider_settings->{fields} ) { |
25
|
|
|
|
|
|
|
$fields = "&fields=".$self->provider_settings->{fields}; |
26
|
1
|
|
|
|
|
25
|
} |
27
|
1
|
50
|
|
|
|
7
|
|
28
|
0
|
|
|
|
|
0
|
my $session_data = $session->read('oauth'); |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $resp = $self->{ua}->request( |
31
|
1
|
|
|
|
|
4
|
GET $self->provider_settings->{urls}{user_info}."?access_token=". |
32
|
|
|
|
|
|
|
$session_data->{facebook}{access_token}. |
33
|
|
|
|
|
|
|
$fields |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
1
|
|
|
|
|
27
|
if( $resp->is_success ) { |
37
|
|
|
|
|
|
|
my $user = $self->_stringify_json_booleans( |
38
|
|
|
|
|
|
|
JSON::MaybeXS::decode_json( $resp->content ) |
39
|
1
|
50
|
|
|
|
349
|
); |
40
|
1
|
|
|
|
|
14
|
$session_data->{facebook}{user_info} = $user; |
41
|
|
|
|
|
|
|
$session->write('oauth', $session_data); |
42
|
|
|
|
|
|
|
} |
43
|
1
|
|
|
|
|
3
|
|
44
|
1
|
|
|
|
|
4
|
} |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
1; |