Bernd Wurst
Warnung auf der Startseite, wenn trotz Passkey-Login noch der SSH-Login mit Passwort aktiviert ist
Bernd Wurst commited 8541423 at 2023-12-09 07:57:22
passkey_ajax.php
<?php
/*
This file belongs to the Webinterface of schokokeks.org Hosting
Written by schokokeks.org Hosting, namely
Bernd Wurst <bernd@schokokeks.org>
Hanno Böck <hanno@schokokeks.org>
This code is published under a 0BSD license.
Nevertheless, in case you use a significant part of this code, we ask (but not require, see the license) that you keep the authors' names in place and return your changes to the public. We would be especially happy if you tell us what you're going to do with this code.
*/
require_once('passkey.php');
require_once('inc/base.php');
require_once('vendor/autoload.php');
$req = filter_input(INPUT_POST, 'req');
// Relying Party == Hostname
$rpId = $_SERVER['HTTP_HOST'];
$WebAuthn = new lbuchs\WebAuthn\WebAuthn(config('company_name') . ' Webinterface', $rpId, ["none"]);
if ($req == 'getCreateArgs') {
require_role(ROLE_SYSTEMUSER);
$userId = dechex($_SESSION['userinfo']['uid']); // Hex-formatted internal ID not displayed to the user
if (strlen($userId) % 2 == 1) {
$userId = "0" . $userId;
}
$userName = $_SESSION['userinfo']['username'];
$_SESSION['passkey_handle'] = filter_input(INPUT_POST, "handle");
$userDisplayName = $_SESSION['userinfo']['name'];
if ($_SESSION['passkey_handle']) {
$userDisplayName = $userDisplayName . " ({$_SESSION['passkey_handle']})";
}
$requireResidentKey = 'required';
$userVerification = 'preferred';
$timeout = 3 * 60;
$createArgs = $WebAuthn->getCreateArgs(\hex2bin($userId), $userName, $userDisplayName, $timeout, $requireResidentKey, $userVerification);
// save challange to session. you have to deliver it to processGet later.
$_SESSION['challenge'] = ($WebAuthn->getChallenge())->getBinaryString();
header('Content-Type: application/json');
print(json_encode($createArgs));
} elseif ($req == 'processCreate') {
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX