Catalyst/ActionRole/OAuth2/AuthToken/ViaRefreshToken.pm

filter: Statementstmt 86.3% 19 / 22 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 82.7% 24 / 29 SCAR 0.0
CC
1
Cov
86%
__ANON__
2.0
build_oauth2_request
1.0
BEGIN
1.0
CRAP 1.0
« CatalystX/OAuth2/Schema/Result/Client.pm ↑ Summary Catalyst/ActionRole/OAuth2/AuthToken/ViaAuthGrant.pm »
1 package Catalyst::ActionRole::OAuth2::AuthToken::ViaRefreshToken;
2 9 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 9 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use CatalystX::OAuth2::Request::RefreshToken;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 # ABSTRACT: Authorization token refresh provider endpoint for OAuth2 authentication flows
7  
8  
9 9 with 'CatalystX::OAuth2::ActionRole::Token';
10  
11 sub build_oauth2_request {
12 2 ▶ my ( $self, $controller, $c ) = @_;
Subroutine build_oauth2_request: called CC=1 SCAR=0.2
Pod undocumented
13  
14 2 my $store = $controller->store;
15 2 my $req;
16  
17 try {
18 $req = CatalystX::OAuth2::Request::RefreshToken->new(
19 2 ▶ %{ $c->req->query_parameters } );
Subroutine __ANON__: called CC=1 SCAR=0.0
20 2 $req->store($store);
21 }
22 catch {
23 0 ▶ $c->log->error($_);
Subroutine __ANON__: not called CC=1 SCAR=6.9
24 # need to figure out a better way, but this will do for now
25 0 $c->res->body('warning: response_type/client_id invalid or missing');
26  
27 0 $c->detach;
28 2 };
29  
30 2 return $req;
31 }
32  
33 9 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
« CatalystX/OAuth2/Schema/Result/Client.pm ↑ Summary Catalyst/ActionRole/OAuth2/AuthToken/ViaAuthGrant.pm »