cmuench/yubikey

此软件包已被废弃,不再维护。未建议替代软件包。

Yubikey 客户端库

dev-master 2016-08-10 23:14 UTC

This package is auto-updated.

Last update: 2022-02-23 23:10:20 UTC


README

Build Status Code Climate Test Coverage

提供了一个 \CMuench\Yubikey\AuthenticationClient 类,可用于对 yubikey 认证服务器进行身份验证。

可以通过配置添加自己的服务器。

示例

<?php

require_once 'vendor/autoload.php';

// with Guzzle
// composer require "php-http/guzzle5-adapter"

$otp = '<otp>'; // Onetime password
$yubikey = '<yubikey>'; // Yubikey of the user
$clientId = '<client_id>'; // Client-ID of the application
$clientSecret = '<api_secret>'; // API-Secret of the application

$apiConfiguration = new \CMuench\Yubikey\Value\ApiConfiguration($clientId, $clientSecret);

$httpClient = new \Http\Adapter\Guzzle5();
$requestFactory = new \Http\Message\MessageFactory\GuzzleMessageFactory();

$client = new \CMuench\Yubikey\AuthenticationClient($apiConfiguration, $httpClient, $requestFactory);

$isValid = $client->verify($otp, $yubikey);