| 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!')
MC/DC0%0/1
$_[0]{'url_token'} || die('Need security token first!')
$_[0]{'url_token'}
Truth table50%1/2
A
A= $_[0]{'url_token'}
| |||||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | 1 | 1; | |||||||||||