This commit is contained in:
Roland Gruber 2019-11-21 22:03:42 +01:00
parent db48e32dc6
commit e329c28c3e
5 changed files with 73 additions and 1 deletions

8
lam/composer.json Normal file
View File

@ -0,0 +1,8 @@
{
"config": {
"vendor-dir": "lib/3rdParty/composer"
},
"require" : {
"web-auth/webauthn-lib" : "2.1.7"
}
}

49
lam/lib/webauthn.inc Normal file
View File

@ -0,0 +1,49 @@
<?php
namespace LAM\LOGIN\WEBAUTHN;
/*
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/**
* Manages webauthn requests.
*
* @author Roland Gruber
*/
/**
* Returns if the given DN is registered for webauthn.
*
* @param string $dn DN
* @return boolean is registered
*/
function isRegistered($dn) {
return false;
}
/**
* Returns a challenge for a new token.
*
* @return string challenge
*/
function getChallenge() {
}

View File

@ -1386,6 +1386,7 @@ window.lam.webauthn.run = function(prefix) {
var data = {
action: 'status',
jsonInput: '',
sec_token: token
};
jQuery.ajax({

View File

@ -190,7 +190,9 @@ echo $config->getTwoFactorAuthenticationCaption();
<script type="text/javascript">
myElement = document.getElementsByName('2factor')[0];
myElement.focus();
if (myElement) {
myElement.focus();
}
</script>
</body>
</html>

View File

@ -101,6 +101,11 @@ class Ajax {
$this->checkPasswordStrength($jsonInput);
die();
}
if ($function === 'webauthn') {
enforceUserIsLoggedIn(false);
$this->manageWebauthn();
die();
}
enforceUserIsLoggedIn();
if ($function == 'passwordChange') {
$this->managePasswordChange($jsonInput);
@ -177,6 +182,13 @@ class Ajax {
echo json_encode(array("result" => $result));
}
/**
* Manages webauthn requests.
*/
private function manageWebauthn() {
$userDN = $_SESSION['ldap']->getUserName();
}
/**
* Handles DN selection fields.
*