line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Catalyst::ActionRole::OAuth2::AuthToken::ViaRefreshToken; |
2
|
8
|
|
|
8
|
|
21401
|
use Moose::Role; |
|
8
|
|
|
|
|
23
|
|
|
8
|
|
|
|
|
84
|
|
3
|
8
|
|
|
8
|
|
43911
|
use Try::Tiny; |
|
8
|
|
|
|
|
32
|
|
|
8
|
|
|
|
|
581
|
|
4
|
8
|
|
|
8
|
|
3634
|
use CatalystX::OAuth2::Request::RefreshToken; |
|
8
|
|
|
|
|
34
|
|
|
8
|
|
|
|
|
1391
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# ABSTRACT: Authorization token refresh provider endpoint for OAuth2 authentication flows |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
with 'CatalystX::OAuth2::ActionRole::Token'; |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
sub build_oauth2_request { |
12
|
2
|
|
|
2
|
0
|
9
|
my ( $self, $controller, $c ) = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
67
|
my $store = $controller->store; |
15
|
2
|
|
|
|
|
6
|
my $req; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
try { |
18
|
|
|
|
|
|
|
$req = CatalystX::OAuth2::Request::RefreshToken->new( |
19
|
2
|
|
|
2
|
|
115
|
%{ $c->req->query_parameters } ); |
|
2
|
|
|
|
|
9
|
|
20
|
2
|
|
|
|
|
84
|
$req->store($store); |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
catch { |
23
|
0
|
|
|
0
|
|
0
|
$c->log->error($_); |
24
|
|
|
|
|
|
|
# need to figure out a better way, but this will do for now |
25
|
0
|
|
|
|
|
0
|
$c->res->body('warning: response_type/client_id invalid or missing'); |
26
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
0
|
$c->detach; |
28
|
2
|
|
|
|
|
34
|
}; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
48
|
return $req; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
1; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
__END__ |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=pod |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 NAME |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Catalyst::ActionRole::OAuth2::AuthToken::ViaRefreshToken - Authorization token refresh provider endpoint for OAuth2 authentication flows |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head1 VERSION |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
version 0.001006 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head1 SYNOPSIS |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
package AuthServer::Controller::OAuth2::Provider; |
50
|
|
|
|
|
|
|
use Moose; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
BEGIN { extends 'Catalyst::Controller::ActionRole' } |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
use URI; |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
with 'CatalystX::OAuth2::Controller::Role::Provider'; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__PACKAGE__->config( |
59
|
|
|
|
|
|
|
store => { |
60
|
|
|
|
|
|
|
class => 'DBIC', |
61
|
|
|
|
|
|
|
client_model => 'DB::Client' |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
sub refresh : Chained('/') Args(0) Does('OAuth2::AuthToken::ViaRefreshToken') {} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 DESCRIPTION |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
This action role implements an endpoint that exchanges a refresh token for an |
72
|
|
|
|
|
|
|
access token. |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 AUTHOR |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Eden Cardim <edencardim@gmail.com> |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Suretec Systems Ltd. |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
83
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |