From 901996fc9760ccb519ba6fb33b6dd95aabae5b4a Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Wed, 9 Oct 2019 18:12:56 +0200 Subject: [PATCH] TT#68300 Do not use authentication if is not configured When we are just using the defaults and there's been no authentication configured, we should just not use any authentication. This makes it possible to use the code with no config file. Change-Id: I9b23cd5ac806f6a56456d70175f9bdfcb436b62c --- lib/NGCP/API/Client.pm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/NGCP/API/Client.pm b/lib/NGCP/API/Client.pm index 97f9855..6821718 100644 --- a/lib/NGCP/API/Client.pm +++ b/lib/NGCP/API/Client.pm @@ -59,9 +59,11 @@ sub _create_ua { $urlbase->host($self->{_opts}{host}); $urlbase->port($self->{_opts}{port}); - $ua->credentials($urlbase->host_port, - 'api_admin_system', #'api_admin_http' - @{$self->{_opts}}{qw(auth_user auth_pass)}); + if (defined $self->{_opts}{auth_user}) { + $ua->credentials($urlbase->host_port, + 'api_admin_system', #'api_admin_http' + @{$self->{_opts}}{qw(auth_user auth_pass)}); + } if ($self->{_opts}{verbose}) { $ua->show_progress(1);