websightnl/yii2-yubikey

为 enygma/yubikey 库提供的组件包装器

dev-master 2016-08-24 08:42 UTC

This package is auto-updated.

Last update: 2024-09-20 22:07:29 UTC


README

设置

https://upgrade.yubico.com/getapikey/ 获取您的API密钥和客户端ID。

// app/config/main.php
return [
    ...
    'components' => [
        ...
        'yubikey' => [
            'class' => 'websightnl\yii2yubikey\Yubikey',
            'apiKey' => '',
            'clientId' => '',
        ]
        ...
    ]
    ...
];

基本用法

$status = Yii::$app->yubikey->validate('tokenfromuser');

配置

该组件支持原始库的大部分参数。有关更多信息,请参阅 https://github.com/enygma/yubikey

// app/config/main.php
return [
    ...
    'components' => [
        ...
        'yubikey' => [
            'class' => 'websightnl\yii2yubikey\Yubikey',
            'apiKey' => '',
            'clientId' => '',
            // Enable HTTPS for the connection (defaults to true)
            'secure' => true,
            // Custom list of validation hosts
            'hosts' => ['validate1.example.org', 'validate2.example.org'],
            // Additonally, the library also supports simultaneous connections to multiple servers.
            'multiServer' => false
            // Additionally, you can also switch on and off this aggregation of the results and go with only the "first in" response
            'firstIn' => true
        ]
        ...
    ]
    ...
];