Git Product home page Git Product logo

php-yubico's Introduction

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 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.5.tgz
$ pear install Auth_Yubico-2.5.tgz

Usage

Note
Make sure that you have read Using a YubiKey OTP library before continuing.

This is an example of how you can use the Yubico.php inside an HTML *.php file:

<?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 demo.php that demonstrates how you may use the package. The script is deployed 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 example/db.sql and configuration for the database needs to go into example/config.php.

The example site is deployed here.

Modhex Calculator

This package also includes Modhex_Calculator.php, a web page illustrating how to work with the modhex encoding. It is deployed 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.

php-yubico's People

Contributors

bjoneill avatar brentboghosian avatar dainnilsson avatar gregorwolf avatar jas4711 avatar jeanpaulgalea avatar klali avatar minisu avatar odanielson avatar rjkip avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.