uzyn/cakephp-opauth
Fork: 61 Star: 128 (更新于 2024-11-27 09:25:45)
license: NOASSERTION
Language: PHP .
Opauth plugin for CakePHP v2.x, allowing simple plug-n-play 3rd-party authentication with CakePHP
最后发布版本: 1.0.8 ( 2014-11-25 00:41:36)
CakePHP plugin for Opauth
CakePHP 2.x plugin for Opauth.
Opauth is a multi-provider authentication framework.
Requirements
CakePHP v2.x
Opauth >= v0.2 (submoduled with this package)
Using Composer?
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.
Tutorial & sample app
Check out CakePHP bakery for tutorial and the sample branch for a quick sample app.
How to use
-
Install this plugin for your CakePHP app.
AssumingAPP
is the directory where your CakePHP app resides, it's usuallyapp/
from the base of CakePHP.cd APP/Plugin git clone git://github.com/uzyn/cakephp-opauth.git Opauth
-
Download Opauth library as a submodule.
git submodule init git submodule update
-
Add this line to the bottom of your app's
Config/bootstrap.php
:<?php CakePlugin::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:<?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' ));
-
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:<?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:<?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']
. -
(optional) The submoduled Opauth core library may not be of the latest build, to update to the latest:
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 :
<?php // APP/Config/bootstrap.php
Configure::write('Opauth.path', '/your-cake-app/auth/');
Issues & questions
- Discussion group: Google Groups
This is the primary channel for support, especially for user questions. - Issues: Github Issues
- Twitter: @uzyn
- Email me: chua@uzyn.com
- IRC: #opauth on Freenode
Used this plugin in your CakePHP project? Let us know!
License
The MIT License
Copyright © 2012-2013 U-Zyn Chua (http://uzyn.com)
Package building instructions
Instructions for making into a nice zipped package for download.
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.
最近版本更新:(数据更新于 2024-09-17 13:10:36)
2014-11-25 00:41:36 1.0.8
uzyn/cakephp-opauth同语言 PHP最近更新仓库
2024-12-13 19:38:03 coollabsio/coolify
2024-12-13 09:22:46 w7corp/easywechat
2024-12-11 20:15:22 symfony/symfony
2024-11-29 16:49:37 symfony/var-dumper
2024-11-20 23:58:25 laravel/framework
2024-11-20 18:39:23 danielmiessler/SecLists