2017 © Pedro Peláez
 

cakephp-plugin cakephp-opauth

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

image

uzyn/cakephp-opauth

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  • Monday, November 24, 2014
  • by uzyn
  • Repository
  • 21 Watchers
  • 130 Stars
  • 46,565 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 65 Forks
  • 17 Open issues
  • 10 Versions
  • 6 % Grown

The README.md

CakePHP plugin for Opauth

CakePHP 2.x plugin for Opauth., (*1)

Opauth is a multi-provider authentication framework., (*2)

Requirements

CakePHP v2.x
Opauth >= v0.2 (submoduled with this package), (*3)

Using Composer?

You can install CakePHP-Opauth plugin directly from Composer at uzyn/cakephp-opauth.
It works for Opauth strategies too!, (*4)

View notes and Composer-enabled plugin code at composer branch., (*5)

Tutorial & sample app

Check out CakePHP bakery for tutorial and the sample branch for a quick sample app., (*6)

How to use

  1. Install this plugin for your CakePHP app.
    Assuming APP is the directory where your CakePHP app resides, it's usually app/ from the base of CakePHP., (*7)

    cd APP/Plugin
    git clone git://github.com/uzyn/cakephp-opauth.git Opauth
    
  2. Download Opauth library as a submodule., (*8)

    git submodule init
    git submodule update
    
  3. Add this line to the bottom of your app's Config/bootstrap.php:, (*9)

    <?php
    CakePlugin::load('Opauth', array('routes' => true, 'bootstrap' => true));
    

    Overwrite any Opauth configurations you want after the above line., (*10)

  4. Load strategies onto Strategy/ directory., (*11)

    Append configuration for strategies at your app's Config/bootstrap.php as follows:, (*12)

    <?php
    CakePlugin::load('Opauth', array('routes' => true, 'bootstrap' => true));
    
    // Using Facebook strategy as an example
    Configure::write('Opauth.Strategy.Facebook', array(
       'app_id' => 'YOUR FACEBOOK APP ID',
       'app_secret' => 'YOUR FACEBOOK APP SECRET'
    ));
    
  5. Go to http://path_to_your_cake_app/auth/facebook to authenticate with Facebook, and similarly for other strategies that you have loaded., (*13)

  6. After validation, user will be redirected to Router::url('/opauth-complete') with validated auth response data retrievable available at $this->data., (*14)

    To route a controller to handle the response, at your app's Config/routes.php, add a connector, for example:, (*15)

    <?php
    Router::connect(
       '/opauth-complete/*', 
       array('controller' => 'users', 'action' => 'opauth_complete')
    );
    

    You can then work with the authentication data at, say APP/Controller/UsersController.php as follows:, (*16)

    <?php // APP/Controller/UsersController.php:
    class UsersController extends AppController {
       public function opauth_complete() {
           debug($this->data);
       }
    }
    

    Note that this CakePHP Opauth plugin already does auth response validation for you with its results available as a boolean value at $this->data['validated']., (*17)

  7. (optional) The submoduled Opauth core library may not be of the latest build, to update to the latest:, (*18)

    git submodule foreach git pull origin master
    

Note:

If your CakePHP app does not reside at DocumentRoot (eg. http://localhost), but at a directory below DocumentRoot (eg. http://localhost/your-cake-app),
add this line to your app's APP/Config/bootstrap.php, replacing your-cake-app with your actual path :, (*19)

<?php // APP/Config/bootstrap.php
Configure::write('Opauth.path', '/your-cake-app/auth/');

Issues & questions

Used this plugin in your CakePHP project? Let us know!, (*20)

License

The MIT License
Copyright © 2012-2013 U-Zyn Chua (http://uzyn.com), (*21)

Package building instructions

Instructions for making into a nice zipped package for download., (*22)

git checkout master
git submodule update --init --recursive

rm -rf `find . -type d -name .git`

cd ..
mv cakephp-opauth Opauth

zip -mr Opauth-CakePHP-plugin-X.Y.Z.zip Opauth

Consultation

U-Zyn Chua is the Principal Consultant at Zynesis Consulting, specializing in CakePHP.
Looking for PHP web development solutions or consultation? Drop me a mail., (*23)

The Versions

24/11 2014

dev-composer

dev-composer http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

24/11 2014

1.0.8

1.0.8.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

27/06 2013

1.0.7

1.0.7.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

30/01 2013

1.0.6

1.0.6.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

10/01 2013

1.0.5

1.0.5.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

03/01 2013

1.0.4

1.0.4.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

03/01 2013

1.0.3

1.0.3.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

02/01 2013

1.0.2

1.0.2.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

05/12 2012

1.0.1

1.0.1.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth

08/09 2012

1.0.0

1.0.0.0 http://opauth.org

Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP

  Sources   Download

MIT

The Requires

 

authentication oauth cakephp auth opauth