line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CatalystX::OAuth2::Controller::Role::Provider; |
2
|
8
|
|
|
8
|
|
24579239
|
use Moose::Role; |
|
8
|
|
|
|
|
28
|
|
|
8
|
|
|
|
|
86
|
|
3
|
8
|
|
|
8
|
|
54759
|
use MooseX::SetOnce; |
|
8
|
|
|
|
|
114615
|
|
|
8
|
|
|
|
|
349
|
|
4
|
8
|
|
|
8
|
|
80
|
use Moose::Util; |
|
8
|
|
|
|
|
22
|
|
|
8
|
|
|
|
|
75
|
|
5
|
8
|
|
|
8
|
|
1775
|
use Class::Load; |
|
8
|
|
|
|
|
20
|
|
|
8
|
|
|
|
|
2254
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: A role for writing oauth2 provider controllers |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'CatalystX::OAuth2::Controller::Role::WithStore'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
has $_ => ( |
12
|
|
|
|
|
|
|
isa => 'Catalyst::Action', |
13
|
|
|
|
|
|
|
is => 'rw', |
14
|
|
|
|
|
|
|
traits => [qw(SetOnce)], |
15
|
|
|
|
|
|
|
predicate => "_has_$_" |
16
|
|
|
|
|
|
|
) for qw(_request_auth_action _get_auth_token_via_auth_grant_action); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
around create_action => sub { |
19
|
|
|
|
|
|
|
my $orig = shift; |
20
|
|
|
|
|
|
|
my $self = shift; |
21
|
|
|
|
|
|
|
my $action = $self->$orig(@_); |
22
|
|
|
|
|
|
|
if ( |
23
|
|
|
|
|
|
|
Moose::Util::does_role( |
24
|
|
|
|
|
|
|
$action, 'Catalyst::ActionRole::OAuth2::RequestAuth' |
25
|
|
|
|
|
|
|
) |
26
|
|
|
|
|
|
|
) |
27
|
|
|
|
|
|
|
{ |
28
|
|
|
|
|
|
|
$self->_request_auth_action($action); |
29
|
|
|
|
|
|
|
} elsif ( |
30
|
|
|
|
|
|
|
Moose::Util::does_role( |
31
|
|
|
|
|
|
|
$action, 'Catalyst::ActionRole::OAuth2::GrantAuth' |
32
|
|
|
|
|
|
|
) |
33
|
|
|
|
|
|
|
) |
34
|
|
|
|
|
|
|
{ |
35
|
|
|
|
|
|
|
$self->_get_auth_token_via_auth_grant_action($action); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
return $action; |
39
|
|
|
|
|
|
|
}; |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub check_provider_actions { |
42
|
33
|
|
|
33
|
0
|
473
|
my ($self) = @_; |
43
|
33
|
50
|
33
|
|
|
1674
|
die |
44
|
|
|
|
|
|
|
q{You need at least an auth action and a grant action for this controller to work} |
45
|
|
|
|
|
|
|
unless $self->_has__request_auth_action |
46
|
|
|
|
|
|
|
&& $self->_has__get_auth_token_via_auth_grant_action; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
after register_actions => sub { |
50
|
|
|
|
|
|
|
shift->check_provider_actions; |
51
|
|
|
|
|
|
|
}; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 NAME |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
CatalystX::OAuth2::Controller::Role::Provider - A role for writing oauth2 provider controllers |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head1 VERSION |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
version 0.001007 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 AUTHOR |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Eden Cardim <edencardim@gmail.com> |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Suretec Systems Ltd. |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
76
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=cut |