Name: cakephp-opauth
Owner: University of Washington Clinical Informatics Research Group
Description: Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP
Forked from: uzyn/cakephp-opauth
Created: 2015-08-11 01:12:24.0
Updated: 2017-01-13 18:44:06.0
Pushed: 2017-05-12 04:49:59.0
Size: 215
Language: PHP
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
CakePHP 2.x plugin for Opauth.
Opauth is a multi-provider authentication framework.
CakePHP v2.x
Opauth >= v0.2 (submoduled with this package)
You can install CakePHP-Opauth plugin directly from Composer at uzyn/cakephp-opauth.
It works for Opauth strategies too!
View notes and Composer-enabled plugin code at composer branch.
Check out CakePHP bakery for tutorial and the sample branch for a quick sample app.
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.
PP/Plugin
clone git://github.com/uzyn/cakephp-opauth.git Opauth
Download Opauth library as a submodule.
submodule init
submodule update
Add this line to the bottom of your app's Config/bootstrap.php
:
p
Plugin::load('Opauth', array('routes' => true, 'bootstrap' => true));
Overwrite any Opauth configurations you want after the above line.
Load strategies onto Strategy/
directory.
Append configuration for strategies at your app's Config/bootstrap.php
as follows:
p
Plugin::load('Opauth', array('routes' => true, 'bootstrap' => true));
sing Facebook strategy as an example
igure::write('Opauth.Strategy.Facebook', array(
app_id' => 'YOUR FACEBOOK APP ID',
app_secret' => 'YOUR FACEBOOK APP SECRET'
Go to http://path_to_your_cake_app/auth/facebook
to authenticate with Facebook, and similarly for other strategies that you have loaded.
After validation, user will be redirected to Router::url('/opauth-complete')
with validated auth response data retrievable available at $this->data
.
To route a controller to handle the response, at your app's Config/routes.php
, add a connector, for example:
p
er::connect(
/opauth-complete/*',
rray('controller' => 'users', 'action' => 'opauth_complete')
You can then work with the authentication data at, say APP/Controller/UsersController.php
as follows:
p // APP/Controller/UsersController.php:
s UsersController extends AppController {
ublic 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']
.
(optional) The submoduled Opauth core library may not be of the latest build, to update to the latest:
submodule foreach git pull origin master
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 :
p // APP/Config/bootstrap.php
igure::write('Opauth.path', '/your-cake-app/auth/');
Used this plugin in your CakePHP project? Let us know!
The MIT License
Copyright © 2012-2013 U-Zyn Chua (http://uzyn.com)
Instructions for making into a nice zipped package for download.
checkout master
submodule update --init --recursive
rf `find . -type d -name .git`
.
akephp-opauth Opauth
-mr Opauth-CakePHP-plugin-X.Y.Z.zip Opauth
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.