Skip to content

Commit

Permalink
Merge pull request #21 from dylanwh/master
Browse files Browse the repository at this point in the history
avoid returning from a Try::Tiny callback
  • Loading branch information
Lee J authored Dec 1, 2018
2 parents 2fad69b + 4173fda commit 26f22d3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/Net/OAuth2/AuthorizationServer/AuthorizationCodeGrant.pm
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,14 @@ sub _verify_auth_code_jwt {

my $auth_code_payload;

my $invalid_jwt;
try {
$auth_code_payload = Mojo::JWT->new( secret => $self->jwt_secret )->decode( $auth_code );
}
catch {
return ( 0, 'invalid_grant' );
$invalid_jwt = 1;
};
return ( 0, 'invalid_grant' ) if $invalid_jwt;

if ( !$auth_code_payload
or $auth_code_payload->{ type } ne 'auth'
Expand Down
4 changes: 3 additions & 1 deletion lib/Net/OAuth2/AuthorizationServer/Defaults.pm
Original file line number Diff line number Diff line change
Expand Up @@ -273,13 +273,15 @@ sub _verify_access_token_jwt {

my $access_token_payload;

my $invalid_jwt;
try {
$access_token_payload =
Mojo::JWT->new( secret => $self->jwt_secret )->decode( $access_token );
}
catch {
return ( 0, 'invalid_grant' );
$invalid_jwt = 1;
};
return ( 0, 'invalid_grant' ) if $invalid_jwt;

if (
$access_token_payload
Expand Down

0 comments on commit 26f22d3

Please sign in to comment.