Today everyone is in a rapid hustle. So mostly internet users find registration process as very time consuming. Sometimes they might leave your web product if they just want to avoid that annoying registration process. So a very good alternative to this is using OpenId. OpenId is a great way to make your authentication system even more flexible.
First of all your PHP must have OpenID Library. You can download it from this Link. When you are done with downloading library then extract the folder named as Auth into your web application’s
/vendors/which is in root of your web app besides your app folder.
Second you must have OpenId plugin for Cakephp. To download this plugin follow this link. Now similarly extract this download to your
/app/plugins/ folder. After extracting you will have openid folder inside your
- First of all you need to replace that OpenId’s Auth component with cakephp’s default Auth component. To do that edit your
appcontroller.phpfile. By implementing below code will extend Auth component functionality. One thing that is very important here is that you still have power of old Auth Component. You can still use it’s variables and functions i.e
- Now you need to edit your
login.ctpview file. When below form is submitted then Auth component will try to login user with username and password field. But if it failed to login with username and password then it will check whether OpenId URL is specified or not. If this happens then it will attempt to authenticate URL against OpenID server. If permission granted then OpenAuth component will add user to the session.
var $components = array(
echo $this->Form->input(array('openid' => array('label' => 'OpenID URL')));
This is it, after this all we have working authentication system with OpenId.