OAuth2/Profile.pm

filter: Statementstmt 72.0% 129 / 179 Branchbran 48.0% 25 / 52 Conditioncond 36.7% 25 / 68 MC/DCmcdc 10.0% 4 / 40 Subroutinesub 71.4% 30 / 42 Podpod 53.3% 16 / 30 totaltotal 55.7% 229 / 411 CC 54 SCAR 28.9
CC
54
Cov
60%
add_token
110.0
init
16.2
params_from_response
15.2
CRAP 18.1
↑ Summary OAuth2/AccessToken.pm »
1 # Copyrights 2013-2019 by [Mark Overmeer <markov@cpan.org>].
2 # For other contributors see ChangeLog.
3 # See the manual pages for details on the licensing terms.
4 # Pod stripped from pm file by OODoc 2.02.
5 # This code is part of distribution Net-OAuth2. Meta-POD processed
6 # with OODoc into POD and HTML manual-pages. See README.md
7 # Copyright Mark Overmeer. Licensed under the same terms as Perl itself.
8  
9 package Net::OAuth2::Profile;
10 4 ▶use vars '$VERSION';
Subroutine BEGIN: called CC=1 SCAR=0.0
11 4 $VERSION = '0.67';
12  
13  
14 4 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4 ▶use Carp qw(carp croak confess);
Subroutine BEGIN: called CC=1 SCAR=0.0
18 4 ▶use MIME::Base64 qw(encode_base64);
Subroutine BEGIN: called CC=1 SCAR=0.0
19 4 ▶use LWP::UserAgent ();
Subroutine BEGIN: called CC=1 SCAR=0.0
20 4 ▶use URI ();
Subroutine BEGIN: called CC=1 SCAR=0.0
21 4 ▶use JSON::MaybeXS qw/decode_json/;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 4 ▶use Scalar::Util qw/blessed/;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 4 ▶use Encode qw/encode/;
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 4 ▶use constant MIME_URLENC => 'application/x-www-form-urlencoded';
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 # old names still supported:
28 # bearer_token_scheme => token_scheme
29  
30 sub new(@)
31 2 ▶{ my $class = shift;
Subroutine new: called CC=2 SCAR=7.1
Pod documented
32 2 ▶ $class ne __PACKAGE__
Branch: 1 branch
BranchTrueFalseTotal
$class ne __PACKAGE__ or carp("you need to create an extension, not base-class Net::OAuth2::Profile") 2 0 2
33 or carp 'you need to create an extension, not base-class '.__PACKAGE__;
34 2 (bless {}, $class)->init( {@_} );
35 }
36  
37 # rfc6849 Appendix B, http://www.w3.org/TR/1999/REC-html401-19991224
38 sub _url_enc($)
39 4 ▶{ my $x = encode 'utf8', shift; # make bytes
Subroutine _url_enc: called CC=1 SCAR=0.0
40 4 $x =~ s/([^A-Za-z0-9 ])/sprintf("%%%02x", ord $1)/ge;
41 4 $x =~ s/ /+/g;
42 4 $x;
43 }
44  
45 sub init($)
46 2 ▶{ my ($self, $args) = @_;
Subroutine init: called CC=14 SCAR=27.9
Pod undocumented
47 my $id = $self->{NOP_id} = $args->{client_id}
48 2 ▶ or carp "profile needs id";
Branch: 1 branch
BranchTrueFalseTotal
my $id = $self->{"NOP_id"} = $args->{"client_id"} or carp("profile needs id") 2 0 2
49 my $secret = $self->{NOP_secret} = $args->{client_secret}
50 2 ▶ or carp "profile needs secret";
Branch: 1 branch
BranchTrueFalseTotal
my $secret = $self->{"NOP_secret"} = $args->{"client_secret"} or carp("profile needs secret") 2 0 2
51  
52 2 $self->{NOP_id_enc} = _url_enc $id;
53 2 $self->{NOP_secret_enc} = _url_enc $secret;
54  
55 2 ▶ $self->{NOP_agent} = $args->{user_agent} || LWP::UserAgent->new;
Condition33%1/3
$args->{'user_agent'} || 'LWP::UserAgent'->new
l!l&&r!l&&!r
020
MC/DC0%0/2
$args->{'user_agent'} || 'LWP::UserAgent'->new
$args->{'user_agent'} 'LWP::UserAgent'->new
Truth table33%1/3
A || B
A= $args->{'user_agent'}B= 'LWP::UserAgent'->new
ABresult
1X1
011
000
56 $self->{NOP_scheme} = $args->{token_scheme}
57 2 ▶ || $args->{bearer_token_scheme} || 'auth-header:Bearer';
Condition40%2/5
$args->{'token_scheme'} || $args->{'bearer_token_scheme'} || 'auth-header:Bearer'
l!l
02
$args->{"token_scheme"} or $args->{"bearer_token_scheme"}
l!l&&r!l&&!r
002
MC/DC0%0/2
$args->{'token_scheme'} || $args->{'bearer_token_scheme'} || 'auth-header:Bearer'
$args->{"token_scheme"} $args->{"bearer_token_scheme"}
Truth table33%1/3
A or B
A= $args->{"token_scheme"}B= $args->{"bearer_token_scheme"}
ABresult
1X1
011
000
58 2 $self->{NOP_scope} = $args->{scope};
59 2 $self->{NOP_state} = $args->{state};
60 2 $self->{NOP_hd} = $args->{hd};
61 2 ▶ $self->{NOP_method} = $args->{access_token_method} || 'POST';
Condition50%1/2
$args->{'access_token_method'} || 'POST'
l!l
02
MC/DC0%0/1
$args->{'access_token_method'} || 'POST'
$args->{'access_token_method'}
Truth table50%1/2
A
A= $args->{'access_token_method'}
Aresult
11
00
62 2 ▶ $self->{NOP_acc_param} = $args->{access_token_param} || [];
Condition50%1/2
$args->{'access_token_param'} || []
l!l
02
MC/DC0%0/1
$args->{'access_token_param'} || []
$args->{'access_token_param'}
Truth table50%1/2
A
A= $args->{'access_token_param'}
Aresult
11
00
63 2 $self->{NOP_init_params} = $args->{init_params};
64 2 $self->{NOP_grant_type} = $args->{grant_type};
65 $self->{NOP_show_secret} = exists $args->{secrets_in_params}
66 2 ▶ ? $args->{secrets_in_params} : 1;
Branch: 1 branch
BranchTrueFalseTotal
exists $args->{'secrets_in_params'} ? : 0 2 2
67  
68 2 my $site = $self->{NOP_site} = $args->{site};
69 2 foreach my $c (qw/access_token protected_resource authorize refresh_token/)
70 8 ▶ { my $link = $args->{$c.'_url'} || $args->{$c.'_path'} || "/oauth/$c";
Condition100%5/5
$$args{$c . '_url'} || $$args{$c . '_path'} || "/oauth/$c"
l!l
26
$$args{$c . '_url'} or $$args{$c . '_path'}
l!l&&r!l&&!r
116
MC/DC100%2/2
$$args{$c . '_url'} || $$args{$c . '_path'} || "/oauth/$c"
$$args{$c . '_url'} $$args{$c . '_path'}
Truth table100%3/3
A or B
A= $$args{$c . '_url'}B= $$args{$c . '_path'}
ABresult
1X1
011
000
71 8 $self->{"NOP_${c}_url"} = $self->site_url($link);
72 8 ▶ $self->{"NOP_${c}_method"} = $args->{$c.'_method'} || 'POST';
Condition100%2/2
$$args{$c . '_method'} || 'POST'
l!l
17
MC/DC100%1/1
$$args{$c . '_method'} || 'POST'
$$args{$c . '_method'}
Truth table100%2/2
A
A= $$args{$c . '_method'}
Aresult
11
00
73 8 ▶ $self->{"NOP_${c}_param"} = $args->{$c.'_param'} || [];
Condition50%1/2
$$args{$c . '_param'} || []
l!l
08
MC/DC0%0/1
$$args{$c . '_param'} || []
$$args{$c . '_param'}
Truth table50%1/2
A
A= $$args{$c . '_param'}
Aresult
11
00
74 }
75  
76 2 $self;
77 }
78  
79 #----------------
80  
81 3 ▶sub id() {shift->{NOP_id}}
Subroutine id: called CC=1 SCAR=0.0
Pod documented
82 0 ▶sub id_enc() {shift->{NOP_id_enc}}
Subroutine id_enc: not called CC=1 SCAR=6.9
Pod undocumented
83 2 ▶sub secret() {shift->{NOP_secret}}
Subroutine secret: called CC=1 SCAR=0.0
Pod documented
84 0 ▶sub secret_enc() {shift->{NOP_secret_enc}}
Subroutine secret_enc: not called CC=1 SCAR=6.9
Pod undocumented
85 1 ▶sub user_agent() {shift->{NOP_agent}}
Subroutine user_agent: called CC=1 SCAR=0.0
Pod documented
86 11 ▶sub site() {shift->{NOP_site}}
Subroutine site: called CC=1 SCAR=0.0
Pod documented
87 0 ▶sub scope() {shift->{NOP_scope}}
Subroutine scope: not called CC=1 SCAR=6.9
Pod documented
88 1 ▶sub state() {shift->{NOP_state}}
Subroutine state: called CC=1 SCAR=0.0
Pod documented
89 1 ▶sub hd() {shift->{NOP_hd}}
Subroutine hd: called CC=1 SCAR=0.0
Pod documented
90 1 ▶sub grant_type() {shift->{NOP_grant_type}}
Subroutine grant_type: called CC=1 SCAR=0.0
Pod documented
91  
92 0 ▶sub bearer_token_scheme() {shift->{NOP_scheme}}
Subroutine bearer_token_scheme: not called CC=1 SCAR=6.9
Pod documented
93  
94 #----------------
95  
96 sub request($@)
97 0 ▶{ my ($self, $request) = (shift, shift);
Subroutine request: not called CC=1 SCAR=6.9
Pod documented
98 #print $request->as_string;
99 0 my $response = $self->user_agent->request($request, @_);
100 #print $response->as_string;
101 #$response;
102 }
103  
104  
105 sub request_auth(@)
106 0 ▶{ my ($self, $token) = (shift, shift);
Subroutine request_auth: not called CC=2 SCAR=17.9
Pod documented
107 0 my $request;
108 0 ▶ if(@_==1) { $request = shift }
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1) { } 0 0 0
109 else
110 0 { my ($method, $uri, $header, $content) = @_;
111 0 $request = HTTP::Request->new
112 ( $method => $self->site_url($uri)
113 , $header, $content
114 );
115 }
116 0 $self->add_token($request, $token, $self->bearer_token_scheme);
117 0 $self->request($request);
118 }
119  
120 #--------------------
121  
122 sub site_url($@)
123 10 ▶{ my ($self, $path) = (shift, shift);
Subroutine site_url: called CC=5 SCAR=16.1
Pod documented
124 10 ▶ my @params = @_==1 && ref $_[0] eq 'HASH' ? %{$_[0]} : @_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 && ref $_[0] eq 'HASH' ? : 1 9 10
Condition66%2/3
@_ == 1 and ref $_[0] eq "HASH"
!ll&&!rl&&r
901
MC/DC50%1/2
@_ == 1 and ref $_[0] eq "HASH"
@_ == 1 ref $_[0] eq "HASH"
Truth table66%2/3
A and B
A= @_ == 1B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
125 10 my $site = $self->site;
126 10 ▶ my $uri = $site ? URI->new_abs($path, $site) : URI->new($path);
Branch: 1 branch
BranchTrueFalseTotal
$site ? : 6 4 10
127 10 ▶ $uri->query_form($uri->query_form, @params) if @params;
Branch: 1 branch
BranchTrueFalseTotal
if @params 2 8 10
128 10 $uri;
129 }
130  
131  
132 sub add_token($$$)
133 0 ▶{ my ($self, $request, $token, $bearer) = @_;
Subroutine add_token: not called CC=10 SCAR=47.0
Pod documented
134 0 my $access = $token->access_token;
135  
136 0 my ($scheme, $opt) = split ':', $bearer;
137 0 $scheme = lc $scheme;
138 0 ▶ if($scheme eq 'auth-header')
Branch: 3 branches
BranchTrueFalseTotal
if ($scheme eq 'auth-header') { } 0 0 0
elsif ($scheme eq 'uri-query') { } 0 0 0
elsif ($scheme eq 'form-body') { } 0 0 0
139 { # Specs suggest using Bearer or OAuth2 for this value, but OAuth
140 # appears to be the de facto accepted value.
141 # Going to use OAuth until there is wide acceptance of something else.
142 0 ▶ my $auth_scheme = $opt || 'OAuth';
Condition0%0/2
$opt || 'OAuth'
l!l
00
MC/DC0%0/1
$opt || 'OAuth'
$opt
Truth table0%0/2
A
A= $opt
Aresult
11
00
143 0 $request->headers->header(Authorization => "$auth_scheme $access");
144 }
145 elsif($scheme eq 'uri-query')
146 0 ▶ { my $query_param = $opt || 'oauth_token';
Condition0%0/2
$opt || 'oauth_token'
l!l
00
MC/DC0%0/1
$opt || 'oauth_token'
$opt
Truth table0%0/2
A
A= $opt
Aresult
11
00
147 0 $request->uri->query_form($request->uri->query_form
148 , $query_param => $access);
149 }
150 elsif($scheme eq 'form-body')
151 0 ▶ { $request->headers->content_type eq MIME_URLENC
Branch: 1 branch
BranchTrueFalseTotal
$request->headers->content_type eq "application/x-www-form-urlencoded" or croak("embedding access token in request body is only valid for 'MIME_URLENC' content type") 0 0 0
152 or croak "embedding access token in request body is only valid "
153 . "for 'MIME_URLENC' content type";
154  
155 0 ▶ my $query_param = $opt || 'oauth_token';
Condition0%0/2
$opt || 'oauth_token'
l!l
00
MC/DC0%0/1
$opt || 'oauth_token'
$opt
Truth table0%0/2
A
A= $opt
Aresult
11
00
156 0 my $content = $request->content;
157 0 ▶ $request->add_content(($content && length $content ? '&' : '')
Branch: 1 branch
BranchTrueFalseTotal
$content && length $content ? : 0 0 0
Condition0%0/3
$content and length $content
!ll&&!rl&&r
000
MC/DC0%0/2
$content and length $content
$content length $content
Truth table0%0/3
A and B
A= $contentB= length $content
ABresult
0X0
100
111
158 . uri_escape($query_param).'='.uri_escape($access));
159 }
160 else
161 0 { carp "unknown bearer schema $bearer";
162 }
163  
164 0 $request;
165 }
166  
167  
168 sub build_request($$$)
169 3 ▶{ my ($self, $method, $uri_base, $params) = @_;
Subroutine build_request: called CC=8 SCAR=21.9
Pod documented
170 3 ▶ my %params = ref $params eq 'HASH' ? %$params : @$params;
Branch: 1 branch
BranchTrueFalseTotal
ref $params eq 'HASH' ? : 1 2 3
171  
172 3 my $basic;
173  
174 # rfc6749 section "2.3.1. Client Password"
175 # The Auth Header is always supported, but client_id/client_secret as
176 # parameters may be as well. We do the latter when ->new(secrets_in_params)
177 # to support old servers.
178 3 ▶ unless ($self->{NOP_show_secret})
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"NOP_show_secret"}) 0 3 3
179 {
180 0 $basic = encode_base64("$params{client_id}:$params{client_secret}", '');
181 0 delete @params{qw/client_id client_secret/};
182 }
183  
184 3 my $request;
185  
186 3 ▶ if($method eq 'POST')
Branch: 2 branches
BranchTrueFalseTotal
if ($method eq 'POST') { } 1 2 3
elsif ($method eq 'GET') { } 2 0 2
187 1 { my $p = URI->new('http:'); # taken from HTTP::Request::Common
188 1 $p->query_form(%params);
189  
190 1 $request = HTTP::Request->new
191 ( $method => $uri_base
192 , [Content_Type => MIME_URLENC]
193 , $p->query
194 );
195 }
196 elsif($method eq 'GET')
197 2 ▶ { my $uri = blessed $uri_base && $uri_base->isa('URI')
Branch: 1 branch
BranchTrueFalseTotal
builtin::blessed($uri_base) && $uri_base->isa('URI') ? : 0 2 2
Condition33%1/3
builtin::blessed($uri_base) and $uri_base->isa("URI")
!ll&&!rl&&r
200
MC/DC0%0/2
builtin::blessed($uri_base) and $uri_base->isa("URI")
builtin::blessed($uri_base) $uri_base->isa("URI")
Truth table33%1/3
A and B
A= builtin::blessed($uri_base)B= $uri_base->isa("URI")
ABresult
0X0
100
111
198 ? $uri_base->clone : URI->new($uri_base);
199  
200 2 $uri->query_form($uri->query_form, %params);
201 2 $request = HTTP::Request->new($method, $uri);
202 }
203 else
204 0 { confess "unknown request method $method";
205 }
206  
207 3 my $uri = $request->uri;
208 3 my $head = $request->headers;
209 3 $request->protocol('HTTP/1.1');
210  
211 # 2016-01-15 Instagram does not like the portnumber to appear
212 # my ($host, $port) = ($uri->host, $uri->port);
213 # $host .= ':'.$port if $port != $uri->default_port;
214 3 $head->header(Host => $uri->host);
215  
216 3 $head->header(Connection => 'Keep-Alive');
217 3 ▶ $head->header(Authorization => "Basic $basic") if $basic;
Branch: 1 branch
BranchTrueFalseTotal
if $basic 0 3 3
218  
219 3 $request;
220 }
221  
222  
223 sub params_from_response($$)
224 2 ▶{ my ($self, $response, $why) = @_;
Subroutine params_from_response: called CC=9 SCAR=27.2
Pod documented
225 2 my ($error, $content);
226 2 ▶ $content = $response->decoded_content || $response->content if $response;
Branch: 1 branch
BranchTrueFalseTotal
if $response 2 0 2
Condition33%1/3
$response->decoded_content || $response->content
l!l&&r!l&&!r
200
MC/DC0%0/2
$response->decoded_content || $response->content
$response->decoded_content $response->content
Truth table33%1/3
A || B
A= $response->decoded_contentB= $response->content
ABresult
1X1
011
000
227  
228 2 ▶ if(!$response)
Branch: 2 branches
BranchTrueFalseTotal
if (not $response) { } 0 2 2
elsif (not $response->is_success) { } 0 2 2
229 0 { $error = 'no response received';
230 }
231 elsif(!$response->is_success)
232 0 { $error = 'received error: '.$response->status_line;
233 }
234 else
235 { # application/json is often not correctly configured: is not
236 # (yet) an apache pre-configured extension :(
237 2 ▶ if(my $params = eval {decode_json $content} )
Branch: 1 branch
BranchTrueFalseTotal
if (my $params = eval { do { &decode_json($content) } }) 1 1 2
238 { # content is JSON
239 1 ▶ return ref $params eq 'HASH' ? %$params : @$params;
Branch: 1 branch
BranchTrueFalseTotal
ref $params eq 'HASH' ? : 1 0 1
240 }
241  
242 # otherwise form-encoded parameters (I hope)
243 1 my $uri = URI->new;
244 1 $uri->query($content);
245 1 my @res_params = $uri->query_form;
246 1 ▶ return @res_params if @res_params;
Branch: 1 branch
BranchTrueFalseTotal
if @res_params 1 0 1
247  
248 0 $error = "cannot read parameters from response";
249 }
250
251 0 ▶ substr($content, 200) = '...' if length $content > 200;
Branch: 1 branch
BranchTrueFalseTotal
if length $content > 200 0 0 0
252 0 croak "failed oauth call $why: $error\n$content\n";
253 }
254  
255 sub authorize_method() {panic} # user must use autorize url
256 0 ▶sub access_token_method() {shift->{NOP_access_token_method} }
Subroutine access_token_method: not called CC=1 SCAR=6.9
Pod undocumented
257 1 ▶sub refresh_token_method() {shift->{NOP_refresh_token_method} }
Subroutine refresh_token_method: called CC=1 SCAR=0.0
Pod undocumented
258 0 ▶sub protected_resource_method() {shift->{NOP_protected_resource_method} }
Subroutine protected_resource_method: not called CC=1 SCAR=6.9
Pod undocumented
259  
260 1 ▶sub authorize_url() {shift->{NOP_authorize_url}}
Subroutine authorize_url: called CC=1 SCAR=0.0
Pod undocumented
261 1 ▶sub access_token_url() {shift->{NOP_access_token_url}}
Subroutine access_token_url: called CC=1 SCAR=0.0
Pod undocumented
262 1 ▶sub refresh_token_url() {shift->{NOP_refresh_token_url}}
Subroutine refresh_token_url: called CC=1 SCAR=0.0
Pod undocumented
263 0 ▶sub protected_resource_url() {shift->{NOP_protected_resource_url}}
Subroutine protected_resource_url: not called CC=1 SCAR=6.9
Pod undocumented
264  
265 sub authorize_params(%)
266 1 ▶{ my $self = shift;
Subroutine authorize_params: called CC=5 SCAR=18.9
Pod undocumented
267 1 my %params = (@{$self->{NOP_authorize_param}}, @_);
268 1 ▶ $params{scope} ||= $self->scope;
Condition33%1/3
$params{"scope"} ||= $self->scope
l!l&&r!l&&!r
100
MC/DC0%0/2
$params{"scope"} ||= $self->scope
$params{"scope"} $self->scope
Truth table33%1/3
A ||= B
A= $params{"scope"}B= $self->scope
ABresult
1X1
011
000
269 1 ▶ $params{state} ||= $self->state;
Condition33%1/3
$params{"state"} ||= $self->state
l!l&&r!l&&!r
001
MC/DC0%0/2
$params{"state"} ||= $self->state
$params{"state"} $self->state
Truth table33%1/3
A ||= B
A= $params{"state"}B= $self->state
ABresult
1X1
011
000
270 1 ▶ $params{hd} ||= $self->hd;
Condition33%1/3
$params{"hd"} ||= $self->hd
l!l&&r!l&&!r
001
MC/DC0%0/2
$params{"hd"} ||= $self->hd
$params{"hd"} $self->hd
Truth table33%1/3
A ||= B
A= $params{"hd"}B= $self->hd
ABresult
1X1
011
000
271 1 ▶ $params{client_id} ||= $self->id;
Condition33%1/3
$params{"client_id"} ||= $self->id
l!l&&r!l&&!r
010
MC/DC0%0/2
$params{"client_id"} ||= $self->id
$params{"client_id"} $self->id
Truth table33%1/3
A ||= B
A= $params{"client_id"}B= $self->id
ABresult
1X1
011
000
272 1 \%params;
273 }
274  
275 sub access_token_params(%)
276 1 ▶{ my $self = shift;
Subroutine access_token_params: called CC=5 SCAR=18.3
Pod undocumented
277 1 my %params = (@{$self->{NOP_access_token_param}}, @_);
278 1 ▶ $params{code} ||= '';
Condition50%1/2
$params{"code"} ||= ""
l!l
01
MC/DC0%0/1
$params{"code"} ||= ""
$params{"code"}
Truth table50%1/2
A
A= $params{"code"}
Aresult
11
00
279 1 ▶ $params{client_id} ||= $self->id;
Condition33%1/3
$params{"client_id"} ||= $self->id
l!l&&r!l&&!r
010
MC/DC0%0/2
$params{"client_id"} ||= $self->id
$params{"client_id"} $self->id
Truth table33%1/3
A ||= B
A= $params{"client_id"}B= $self->id
ABresult
1X1
011
000
280 1 ▶ $params{client_secret} ||= $self->secret;
Condition33%1/3
$params{"client_secret"} ||= $self->secret
l!l&&r!l&&!r
010
MC/DC0%0/2
$params{"client_secret"} ||= $self->secret
$params{"client_secret"} $self->secret
Truth table33%1/3
A ||= B
A= $params{"client_secret"}B= $self->secret
ABresult
1X1
011
000
281 1 ▶ $params{grant_type} ||= $self->grant_type;
Condition33%1/3
$params{"grant_type"} ||= $self->grant_type
l!l&&r!l&&!r
010
MC/DC0%0/2
$params{"grant_type"} ||= $self->grant_type
$params{"grant_type"} $self->grant_type
Truth table33%1/3
A ||= B
A= $params{"grant_type"}B= $self->grant_type
ABresult
1X1
011
000
282 1 \%params;
283 }
284  
285 sub refresh_token_params(%)
286 0 ▶{ my $self = shift;
Subroutine refresh_token_params: not called CC=3 SCAR=24.8
Pod undocumented
287 0 my %params = (@{$self->{NOP_refresh_token_param}}, @_);
288 0 ▶ $params{client_id} ||= $self->id;
Condition0%0/3
$params{"client_id"} ||= $self->id
l!l&&r!l&&!r
000
MC/DC0%0/2
$params{"client_id"} ||= $self->id
$params{"client_id"} $self->id
Truth table0%0/3
A ||= B
A= $params{"client_id"}B= $self->id
ABresult
1X1
011
000
289 0 ▶ $params{client_secret} ||= $self->secret;
Condition0%0/3
$params{"client_secret"} ||= $self->secret
l!l&&r!l&&!r
000
MC/DC0%0/2
$params{"client_secret"} ||= $self->secret
$params{"client_secret"} $self->secret
Truth table0%0/3
A ||= B
A= $params{"client_secret"}B= $self->secret
ABresult
1X1
011
000
290 0 \%params;
291 }
292  
293 sub protected_resource_params(%)
294 0 ▶{ my $self = shift;
Subroutine protected_resource_params: not called CC=1 SCAR=6.9
Pod undocumented
295 0 my %params = (@{$self->{NOP_protected_resource_param}}, @_);
296 0 \%params;
297 }
298  
299 4 1;
↑ Summary OAuth2/AccessToken.pm »