APIClient/Authn/Password2FA.pm

filter: Statementstmt 100% 24 / 24 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 5 totaltotal 82.9% 34 / 41 CC 2 SCAR 1.9
CC
2
Cov
96%
get_url_path_prefix
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« APIClient/Service/cpanel.pm ↑ Summary APIClient/Request/HTTPBase.pm »
1 package cPanel::APIClient::Authn::Password2FA;
2  
3 # Copyright 2020 cPanel, L. L. C.
4 # All rights reserved.
5 # http://cpanel.net
6 #
7 # This is free software; you can redistribute it and/or modify it under the
8 # same terms as Perl itself. See L<perlartistic>.
9  
10 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use parent 'cPanel::APIClient::Authn';
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 1 ▶use cPanel::APIClient::Utils::HTTPSession;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 1 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
18 1 my ( $class, $username, $password, $tfa_token ) = @_;
19  
20 1 return bless {
21 username => $username,
22 password => $password,
23 tfa_token => $tfa_token,
24 }, $class;
25 }
26  
27 2 ▶sub needs_session { 1 }
Subroutine needs_session: called CC=1 SCAR=0.0
Pod undocumented
28  
29 1 ▶sub get_login_request_pieces {
Subroutine get_login_request_pieces: called CC=1 SCAR=0.0
Pod undocumented
30 1 my ($self) = @_;
31  
32 return cPanel::APIClient::Utils::HTTPSession::get_login_request_pieces(
33 1 @{$self}{ 'username', 'password', 'tfa_token' },
34 );
35 }
36  
37 1 ▶sub consume_session_response {
Subroutine consume_session_response: called CC=1 SCAR=0.0
Pod undocumented
38 1 my ( $self, $resp_obj ) = @_;
39  
40 1 $self->{'url_token'} = cPanel::APIClient::Utils::HTTPSession::parse_token($resp_obj);
41  
42 1 return $self;
43 }
44  
45 1 ▶sub get_url_path_prefix {
Subroutine get_url_path_prefix: called CC=2 SCAR=7.2
Pod undocumented
46 1 my ($self) = @_;
47  
48 1 ▶ return $_[0]{'url_token'} || die 'Need security token first!';
Condition50%1/2
$_[0]{'url_token'} || die('Need security token first!')
l!l
10
MC/DC0%0/1
$_[0]{'url_token'} || die('Need security token first!')
$_[0]{'url_token'}
Truth table50%1/2
A
A= $_[0]{'url_token'}
Aresult
11
00
49 }
50  
51 1 1;
« APIClient/Service/cpanel.pm ↑ Summary APIClient/Request/HTTPBase.pm »