File Coverage

blib/lib/Net/OAuth2Server/Request/Token/TokenExchange.pm
Criterion Covered Total %
statement 9 19 47.3
branch 0 8 0.0
condition n/a
subroutine 3 7 42.8
pod 0 4 0.0
total 12 38 31.5


line stmt bran cond sub pod time code
1 1     1   6 use strict; use warnings;
  1     1   1  
  1         23  
  1         4  
  1         2  
  1         59  
2              
3             package Net::OAuth2Server::Request::Token::TokenExchange;
4             our $VERSION = '0.004';
5              
6 1     1   395 use parent 'Net::OAuth2Server::Request';
  1         269  
  1         6  
7              
8 0     0 0   sub grant_type { 'urn:ietf:params:oauth:grant-type:token-exchange' }
9 0     0 0   sub allowed_methods { 'POST' }
10 0     0 0   sub grant_parameters { qw( subject_token_type subject_token ) }
11             *required_parameters = \&grant_parameters;
12              
13             sub get_grant {
14 0     0 0   my ( $self, $grant_maker ) = ( shift, shift );
15 0 0         return if $self->error;
16              
17 0 0         if ( $self->has_param( 'actor_token' ) ) {
    0          
18 0 0         $self->ensure_required( 'actor_token_type' ) or return;
19             }
20             elsif ( $self->has_param( 'actor_token_type' ) ) {
21 0           $self->set_error_invalid_request( 'extraneous parameter: actor_token_type' );
22 0           return;
23             }
24              
25 0           $grant_maker->from_subject_token( $self, $self->params( $self->grant_parameters ), @_ );
26             }
27              
28             1;