2017 © Pedro Peláez
 

library yubikey

PHP library to interface with the Yubikey REST API

image

enygma/yubikey

PHP library to interface with the Yubikey REST API

  • Wednesday, April 18, 2018
  • by enygma
  • Repository
  • 6 Watchers
  • 54 Stars
  • 200,373 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 14 Forks
  • 6 Open issues
  • 16 Versions
  • 4 % Grown

The README.md

Yubikey PHP Library

Travis-CI Build Status Codacy Badge Code Climate Total Downloads, (*1)

This library lets you easily interface with the Yubico REST API for validating the codes created by the Yubikey., (*2)

Requirements:

  • An API as requested from the Yubico site
  • A client ID requested from Yubico
  • A Yubikey to test out the implementation

Installation

Use the followng command to install the library via Composer:, (*3)

composer require enygma/yubikey

Usage:

Look at the test.php example script to see how to use it. This can be executed like:, (*4)

php test.php [generated key], (*5)

Example code:, (*6)

check($inputtedKey);

echo ($response->success() === true) ? 'success!' : 'you failed. aw.';
?>

HTTP vs HTTPS

By default the library will try to use a HTTPS request to the host given. If you need to disable this for some reason (like no SSL support), you can use the setUseSecure method and set it to false:, (*7)

$v = new \Yubikey\Validate($apiKey, $clientId);
$v->setUseSecure(false);

Overriding hosts

The library comes with a set of hostnames for the Yubico external API servers (api.yubico.com through api5.yubico.com). If you ever have a need to override these, you can use setHosts:, (*8)

$v = new \Yubikey\Validate($apiKey, $clientId);
$v->setHosts(array(
    'api.myhost1.com',
    'api1.myhost.com'
));

Remember, this will overwrite the current hosts in the class, so be sure you don't still need those. If you just want to add another host, look at the addHost method., (*9)

Multi-Server Requests:

Additonally, the library also supports simultaneous connections to multiple servers. By default it will only make the request to the first server in the hosts list. You can enable the multi-server checking with a second parameter on the check() method:, (*10)

```php check($inputtedKey, true); echo ($response->success() === true) ? 'success!' : 'you failed. aw.'; ?>, (*11)


This will make multiple requests and return the pass/fail status of the aggregate responses from each. So, if you have all but one server pass, the overall response will be a fail. If all return `OK` though, you're in the clear. ### "First in" result Additionally, you can also switch on and off this aggregation of the results and go with only the "first in" response. You do this with a flag on the `success` checking method: ```php check($inputtedKey, true); echo ($response->success(true) === true) ? 'success!' : 'you failed. aw.'; ?>

NOTE: This will still work without multi-server checking. The "first in" will just always be the single response., (*12)

@author Chris Cornutt ccornutt@phpdeveloper.org, (*13)

The Versions

18/04 2018

dev-master

9999999-dev https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

08/03 2018

3.3

3.3.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

04/10 2017

dev-add-license

dev-add-license https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

21/04 2015

3.2

3.2.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

19/11 2014

3.1

3.1.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

19/11 2014

3.0

3.0.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

19/11 2014

2.6

2.6.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

18/11 2014

2.5

2.5.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

30/10 2014

2.4

2.4.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

16/10 2014

2.3

2.3.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

16/10 2014

2.2

2.2.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

16/10 2014

2.1

2.1.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

16/10 2014

2.0

2.0.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

  • php >=5.3.1

 

The Development Requires

api rest yubikey twofactor yubico

24/09 2014

1.2

1.2.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

 

api rest yubikey twofactor yubico

14/02 2014

1.1

1.1.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

 

api rest yubikey twofactor yubico

16/03 2013

1.0

1.0.0.0 https://github.com/enygma/yubikey.git

PHP library to interface with the Yubikey REST API

  Sources   Download

MIT

The Requires

 

api rest yubikey twofactor yubico