| 1 | package cPanel::APIClient::Authn::Password; | ||
| 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 | ▶ | sub new { |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 16 | 1 | my ( $class, $username, $password ) = @_; | |
| 17 | |||
| 18 | 1 | return bless [ $username, $password ], $class; | |
| 19 | } | ||
| 20 | |||
| 21 | 1 | ▶ | sub get_http_headers_for_service { |
|
Subroutine
get_http_headers_for_service: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 22 | 1 | my ( $self, $service_obj ) = @_; | |
| 23 | |||
| 24 | 1 | require MIME::Base64; | |
| 25 | |||
| 26 | 1 | my $b64 = MIME::Base64::encode( $self->[0] . ":" . $self->[1] ); | |
| 27 | 1 | $b64 =~ tr<\x0d\x0a><>d; | |
| 28 | |||
| 29 | 1 | return [ Authorization => "Basic $b64" ]; | |
| 30 | } | ||
| 31 | |||
| 32 | 1 | 1; | |