shiji / php-yubico
非官方 Yubico OTP 身份验证库
2.7.1
2020-08-04 18:43 UTC
Requires
- php: >=5.6.0
Requires (Dev)
- phpunit/phpunit: ~5.7
This package is auto-updated.
Last update: 2024-09-05 03:49:43 UTC
README
- 基于 Yubico 的 PEAR 版本
- 将 PEAR 替换为 PHP Composer
Yubico 身份验证 PHP 类提供了一种简单的方法,将 Yubikey 集成到现有的基于 PHP 的用户身份验证基础设施中。使用 Composer 安装简单
安装
composer require shiji/php-yubico
依赖
PHP 需要 cURL 模块。您可以使用以下命令检查:
php -m | grep curl
Debian/Ununtu
sudo apt-get install curl php-curl
从源代码安装
OSX
如果您使用 Homebrew 安装 PHP,则已包含 cURL 和 php_curl
示例
<?php
use Yubico\Auth;
use Yubico\AuthException;
$otp = "ccbbddeertkrctjkkcglfndnlihhnvekchkcctif";
# Generate a new id+key from https://upgrade.yubico.com/getapikey
$yubi = new Auth_Yubico('42', 'FOOBAR=');
try{
$yubi->verify($otp);
} catch (AuthException $e){
// Verification failed
print $e->getMessage();
// Return error message and
// Make sure the execution stops here
return;
}
// Verification passed, continue
?>
许可证
该项目受 BSD 许可证的许可。有关确切措辞,请参阅文件 COPYING。对于在此包中指定为 YYYY-ZZZZ 的任何版权年份范围,请注意该范围指定了该闭区间中的每一年。