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