forked from Yubico/php-yubico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME
75 lines (55 loc) · 2.6 KB
/
README
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
== Auth_Yubico PHP class ==
The Yubico authentication PHP class provides an easy way to integrate
the Yubikey into your existing PHP-based user authentication
infrastructure. Installation is simple using PEAR.
The development community is co-ordinated via
https://github.com/Yubico/php-yubico[the Github project].
=== Installation ===
Make sure your PHP installation supports curl, and that you have
installed PEAR. On Debian/Ubuntu systems:
$ apt-get install libapache2-mod-php5 php5-curl php-pear
Install the component by invoking:
$ wget https://developers.yubico.com/php-yubico/Releases/Auth_Yubico-2.6.tgz
$ pear install Auth_Yubico-2.6.tgz
=== Usage ===
NOTE: Make sure that you have read https://developers.yubico.com/OTP/Libraries/Using_a_library.html[Using a YubiKey OTP library] before continuing.
This is an example of how you can use the `Yubico.php` inside an HTML *.php file:
[source, php]
-----------
<?php
require_once 'Auth/Yubico.php';
$otp = "ccbbddeertkrctjkkcglfndnlihhnvekchkcctif";
# Generate a new id+key from https://upgrade.yubico.com/getapikey
$yubi = new Auth_Yubico('42', 'FOOBAR=');
$auth = $yubi->verify($otp);
if (PEAR::isError($auth)) {
print "<p>Authentication failed: " . $auth->getMessage();
print "<p>Debug output from server: " . $yubi->getLastResponse();
} else {
print "<p>You are authenticated!";
}
?>
-----------
==== API demo
Provided in the package is also a script
https://github.com/Yubico/php-yubico/blob/master/demo.php[demo.php]
that demonstrates how you may use the package. The script is deployed
https://demo.yubico.com/php-yubico/demo.php[here].
==== Example site
There is also a complete example site that demonstrates one-factor and
two-factor mode. It requires a database to store the username and
passwords. Database schema is in
https://github.com/Yubico/php-yubico/blob/master/example/db.sql[example/db.sql]
and configuration for the database needs to go into
https://github.com/Yubico/php-yubico/blob/master/example/config.php[example/config.php].
The example site is deployed https://demo.yubico.com/php-yubico[here].
=== Modhex Calculator
This package also includes
https://github.com/Yubico/php-yubico/blob/master/example/Modhex_Calculator.php[Modhex_Calculator.php],
a web page illustrating how to work with the modhex encoding. It is deployed
https://demo.yubico.com/php-yubico/Modhex_Calculator.php[here]
=== License
The project is licensed under a BSD license. See the file COPYING for
exact wording. For any copyright year range specified as YYYY-ZZZZ in
this package note that the range specifies every single year in that
closed interval.