From 9d7e5c61cc75c23889c23a44b9950ba60929addc Mon Sep 17 00:00:00 2001 From: Maxime Besson Date: Mon, 18 May 2020 12:34:34 +0200 Subject: [PATCH] handle empty string value for yubikey parameters (#2211) --- .../lib/Lemonldap/NG/Portal/2F/Yubikey.pm | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm index be5d053db..782cb653a 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/2F/Yubikey.pm @@ -52,10 +52,18 @@ sub init { $self->yubi( Auth::Yubikey_WebClient->new( { - id => $self->conf->{yubikey2fClientID}, - api => $self->conf->{yubikey2fSecretKey}, - nonce => $self->conf->{yubikey2fNonce}, - url => $self->conf->{yubikey2fUrl} + id => $self->conf->{yubikey2fClientID}, + api => $self->conf->{yubikey2fSecretKey}, + ( + $self->conf->{yubikey2fNonce} + ? ( nonce => $self->conf->{yubikey2fNonce} ) + : () + ), + ( + $self->conf->{yubikey2fUrl} + ? ( url => $self->conf->{yubikey2fUrl} ) + : () + ), } ) );