File Coverage

blib/lib/cPanel/APIClient/Authn/Token.pm
Criterion Covered Total %
statement 14 14 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod 0 2 0.0
total 19 21 90.4


line stmt bran cond sub pod time code
1             package cPanel::APIClient::Authn::Token;
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.
9              
10 2     2   24 use strict;
  2         14  
  2         116  
11 2     2   37 use warnings;
  2         5  
  2         143  
12              
13 2     2   13 use parent 'cPanel::APIClient::Authn';
  2         4  
  2         47  
14              
15             sub new {
16 6     6 0 23 my ( $class, $username, $token ) = @_;
17              
18 6         56 return bless [ $username, $token ], $class;
19             }
20              
21             sub get_http_headers_for_service {
22 6     6 0 16 my ( $self, $service_obj ) = @_;
23              
24 6         22 my $hdr_svc = $service_obj->service_name(); # TODO: check for whostmgr
25              
26 6         42 return [ Authorization => "$hdr_svc $self->[0]:$self->[1]" ];
27             }
28              
29             1;