Add config tests for webauthn

This commit is contained in:
Maxime Besson 2022-02-25 10:39:00 +01:00
parent c45819807f
commit 39da9c64a9
1 changed files with 23 additions and 0 deletions

View File

@ -6,6 +6,7 @@ use strict;
use Lemonldap::NG::Common::Regexp;
use Lemonldap::NG::Handler::Main;
use Lemonldap::NG::Common::Util qw(getSameSite);
use URI;
our $VERSION = '2.0.14';
@ -550,6 +551,28 @@ sub tests {
) if ($@);
}
# Use WebAuthn
if ( $conf->{webauthn2fActivation}
{
eval "use Authen::WebAuthn";
return ( 1,
"Authen::WebAuthn module is required to enable WebAuthn"
) if ($@);
}
# WebAuthn requires https://
if ( $conf->{webauthn2fActivation}
{
my $portal_uri = URI->new($conf->{portal});
if ($portal_uri->scheme eq "https") {
return 1;
} else {
return ( 1,
"WebAuthn requires HTTPS"
);
}
}
# Use Yubikey
if ( $conf->{yubikey2fActivation} ) {
eval "use Auth::Yubikey_WebClient";