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   21 use strict;
  2         12  
  2         102  
11 2     2   26 use warnings;
  2         6  
  2         163  
12              
13 2     2   14 use parent 'cPanel::APIClient::Authn';
  2         4  
  2         47  
14              
15             sub new {
16 6     6 0 21 my ( $class, $username, $token ) = @_;
17              
18 6         53 return bless [ $username, $token ], $class;
19             }
20              
21             sub get_http_headers_for_service {
22 6     6 0 17 my ( $self, $service_obj ) = @_;
23              
24 6         25 my $hdr_svc = $service_obj->service_name(); # TODO: check for whostmgr
25              
26 6         48 return [ Authorization => "$hdr_svc $self->[0]:$self->[1]" ];
27             }
28              
29             1;