line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
769
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
40
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
58
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Net::OAuth2::Scheme::Mixin::Root; |
5
|
|
|
|
|
|
|
BEGIN { |
6
|
1
|
|
|
1
|
|
17
|
$Net::OAuth2::Scheme::Mixin::Root::VERSION = '0.03'; |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
# ABSTRACT: defines the root group setup |
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use Net::OAuth2::Scheme::Option::Defines; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
209
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Define_Group(root => 'setup'); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
my %defined_usage = map {$_,1} qw( |
15
|
|
|
|
|
|
|
access |
16
|
|
|
|
|
|
|
refresh |
17
|
|
|
|
|
|
|
authcode |
18
|
|
|
|
|
|
|
); |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
my %defined_context = map {$_,1} qw( |
21
|
|
|
|
|
|
|
client |
22
|
|
|
|
|
|
|
auth_server |
23
|
|
|
|
|
|
|
resource_server |
24
|
|
|
|
|
|
|
); |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
0
|
0
|
|
sub is_access { return $_[0]->uses('is_access'); } |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# sub is_client ... |
29
|
|
|
|
|
|
|
# sub is_auth_server ... |
30
|
|
|
|
|
|
|
# sub is_resource_server ... |
31
|
|
|
|
|
|
|
{ |
32
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
298
|
|
33
|
|
|
|
|
|
|
for my $whatever (keys %defined_context) { |
34
|
|
|
|
|
|
|
*{"is_${whatever}"} = sub () { |
35
|
|
|
|
|
|
|
# assume not if we have not otherwise said so. |
36
|
0
|
|
|
0
|
|
|
return $_[0]->uses("is_$whatever", 0); |
37
|
|
|
|
|
|
|
}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub pkg_root_setup { |
42
|
0
|
|
|
0
|
0
|
|
my __PACKAGE__ $self = shift; |
43
|
|
|
|
|
|
|
|
44
|
0
|
|
|
|
|
|
my $usage = $self->uses(usage => 'access'); |
45
|
0
|
0
|
|
|
|
|
$self->croak("unknown usage '$usage'") |
46
|
|
|
|
|
|
|
unless $defined_usage{$usage}; |
47
|
0
|
|
|
|
|
|
my $is_access = $self->ensure("is_access", $usage eq 'access'); |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
|
|
|
my $context = $self->uses(context => ($is_access ? () : ([]))); |
50
|
0
|
0
|
|
|
|
|
for my $c (ref($context) ? @$context : ($context)) { |
51
|
0
|
0
|
|
|
|
|
$self->croak("unknown implementation context '$c'") |
52
|
|
|
|
|
|
|
unless $defined_context{$c}; |
53
|
0
|
|
|
|
|
|
$self->ensure("is_$c", 1); |
54
|
|
|
|
|
|
|
} |
55
|
0
|
0
|
|
|
|
|
unless ($is_access) { |
56
|
0
|
|
|
|
|
|
$self->ensure(format_no_params => 1); |
57
|
0
|
|
|
|
|
|
$self->ensure(is_client => 0, 'client implementations do not need refresh-token/authcode schemes'); |
58
|
0
|
|
|
|
|
|
$self->ensure(is_auth_server => 1); |
59
|
0
|
|
|
|
|
|
$self->ensure(is_resource_server => 1); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
$self->export |
62
|
|
|
|
|
|
|
( |
63
|
0
|
0
|
|
|
|
|
(!$self->is_client ? () |
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
64
|
|
|
|
|
|
|
: ( |
65
|
|
|
|
|
|
|
'token_accept', |
66
|
|
|
|
|
|
|
($is_access ? ('http_insert') : ()), |
67
|
|
|
|
|
|
|
)), |
68
|
|
|
|
|
|
|
(!$self->is_resource_server ? () |
69
|
|
|
|
|
|
|
: ( |
70
|
|
|
|
|
|
|
($is_access ? ('psgi_extract') : ()), |
71
|
|
|
|
|
|
|
'token_validate', |
72
|
|
|
|
|
|
|
)), |
73
|
|
|
|
|
|
|
(!$self->is_auth_server ? () |
74
|
|
|
|
|
|
|
: ( |
75
|
|
|
|
|
|
|
'token_create' |
76
|
|
|
|
|
|
|
)), |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
$self->install(root => 'done'); |
80
|
0
|
|
|
|
|
|
return $self; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |