Code Monkey home page Code Monkey logo

lightopenid's Introduction

NOTICE

I am no longer able to support or maintain this project - if you would like to take over the project, please drop me a line.

LightOpenID

Lightweight PHP5 library for easy OpenID authentication.

Quick start

Add to composer.json

"repositories": [
  {
    "type": "vcs",
    "url": "https://github.com/iignatov/LightOpenID"
  }
],

"require": {	
  "php": ">=5.4.0",
  "iignatov/lightopenid": "*"
}

Sign-on with OpenID in just 2 steps:

  1. Authentication with the provider:

    $openid = new LightOpenID('my-host.example.org');
    
    $openid->identity = 'ID supplied by user';
    
    header('Location: ' . $openid->authUrl());
  2. Verification:

    $openid = new LightOpenID('my-host.example.org');
    
    if ($openid->mode) {
      echo $openid->validate() ? 'Logged in.' : 'Failed!';
    }

Support for AX and SREG extensions:

To use the AX and SREG extensions, specify $openid->required and/or $openid->optional before calling $openid->authUrl(). These are arrays, with values being AX schema paths (the 'path' part of the URL). For example:

$openid->required = array('namePerson/friendly', 'contact/email');
$openid->optional = array('namePerson/first');

Note that if the server supports only SREG or OpenID 1.1, these are automaticaly mapped to SREG names. To get the values use:

$openid->getAttributes();

For more information see USAGE.md.

Requirements

This library requires PHP >= 5.1.2 with cURL or HTTP/HTTPS stream wrappers enabled.

Features

  • Easy to use - you can code a functional client in less than ten lines of code.
  • Uses cURL if avaiable, PHP-streams otherwise.
  • Supports both OpenID 1.1 and 2.0.
  • Supports Yadis discovery.
  • Supports only stateless/dumb protocol.
  • Works with PHP >= 5.
  • Generates no errors with error_reporting(E_ALL | E_STRICT).

Links

License

LightOpenID is an open source software available under the MIT License.

lightopenid's People

Contributors

iignatov avatar nhnb avatar vrana avatar landas avatar arthom avatar russor avatar

Watchers

James Cloos avatar Jahangir 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.