• Contact Us
  • About Us
  • Privacy policy
  • Disclaimer and Limitation of Liability
Subscribe RSS
Home » Cakephp » Integrating cakephp with OpenId

Integrating cakephp with OpenId

July 26, 2012 Posted by kaswan under Cakephp
4 Comments

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.

To implement this feature we must have a basic working authentication system.

Click to know how to build basic authentication system.

Prerequisites

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 /app/vendors/ folder.

Note : folder is /app/vendors/ not /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 /app/plugins/.

Coding

  • First of all you need to replace that OpenId’s Auth component with cakephp’s default Auth component. To do that edit your appcontroller.php file. 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 $this->Auth->allow("*");
  • 1
    2
    3
    var $components = array(
          'Openid.OpenAuth'
    );

  • Now you need to edit your login.ctp view 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.
  • 1
    2
    3
    4
    5
    6
    7
    <?php
    echo $this->Form->create(array('action'=>'login'));
    echo $this->Form->input(array('openid' => array('label' => 'OpenID URL')));
    echo $this->Form->input('username');
    echo $this->Form->input('password');
    echo $this->Form->end('Login');
    ?>

Final words

This is it, after this all we have working authentication system with OpenId.

If you liked this post then plz share on these sites
  • Myspace
  • Tweet
Posts that you may find interesting...
Using Uploadify With Cakephp
Auth Component of Cakephp Demystified Part-1
Verify password and confirm password fields are equal or not in cakephp
Tags: Auth Component, Cakephp, OpenId
  • dream_coder

    can u give me a link to openid documentation?

  • Leon

    Dose this really work? I downloaded the codes and put into my app/plugin/ directory. Turns out “The application is trying to load a file from the Openid plugin”.

    • kaswan

      i have tested it before uploading this post. worked perfect for me.

  • http://robhasawiki.com/index.php?title=User:XVASusana Increase traffic Software

    Excellent blog here! Also your web site loads up fast! What host are
    you using? Can I get your affiliate link to your host?
    I wish my web site loaded up as quickly as yours lol

« cross site request forgery or CSRF or XSRF Basics
Auth Component of Cakephp Demystified Part-3 »
  • Latest Posts
  • Random Posts
  • Top 3 Command Prompt Tricks and Hacks
  • how to increase Alexa Rank
  • scrapebox cracked
  • List of top Directories For Backlinks
  • Scrapebox download
  • Scrapebox
  • How to Earn Money through Facebook Fan page
  • Wiki List Scraper for Free
  • How to recover a Facebook stoled page ?
  • Security in terms of Hacking
  • facebook pending friend requests
  • GSM - Global System for Mobile communications
  • 28 Best Web Design Tutorials
  • Eight Queen Simulation
  • how to add all friends in facebook group at once
  • collision in hashing
  • How to bye pass Firewall 2
  • Facebook New Smiley
  • Delete Facebook Messages With Single Click
  • How to send anonymous sms
  • Categories
  • Latest Comments
  • Blogging
  • C and C++ Interview questions
  • C++ Stuff
  • C-related Stuff
    • c tutorials for beginners
    • simple c tutorial
  • Cakephp
  • Campus Placement
  • Cloud Computing
  • College Projects
  • Data Structures
  • Digital Forensic
  • Facebook
  • Google Technology
  • GSM
  • Hacking
    • ABC of Hacking
    • ARP Poisoning
    • Command Prompt
    • Cross Site Request Forgery
    • DNS Poisoning
    • Facebook hacking
    • HBCD
    • Mobile hacking
      • Tethering
    • SQl injection
    • Truecrypt
    • Wireshark
  • Internet
  • Jquery
  • knowledge
  • linux
  • Mobile World
  • My notes On Education
  • N computing
  • Networking
  • Photoshop
  • Search Engine Optimization
  • SEO
  • Software Knowledge
  • Tips and tricks
  • Uncategorized
  • Web Design
  • Web Services



Recent Posts
  • Top 3 Command Prompt Tricks and Hacks
  • how to increase Alexa Rank
  • scrapebox cracked
  • List of top Directories For Backlinks
  • Scrapebox download
Recent Comments
  • Brad Haccer on How to Bypass Facebook Phone Verification
  • How to bye pass Firewall 2 - CrazyLearner.com on How to bye pass Firewall
  • Ethical Hacking Overview - CrazyLearner.com on Types of hacker
  • Nicholas Marturano on How to hack mobile number
  • cycoshas on What is rapidleech ? A simple guide
© CrazyLearner 2013 • Designed by Adhya Solutions