Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

00f100/cakephp-opauth

Package Overview
Dependencies
Maintainers
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

00f100/cakephp-opauth

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

Source
Packagist
Version
dev-master
Version published
Maintainers
2
Created
Source

CakePHP plugin for Opauth

CakePHP 3.x plugin for Opauth.

Opauth is a multi-provider authentication framework.

Requirements

  • CakePHP >= v3.0
  • Opauth >= v1.0

Using Composer

You can install CakePHP-Opauth plugin directly from Composer at wouter0100/cakephp-opauth.

How to use

  • Install this plugin using Composer, add "wouter0100/cakephp-opauth": "*" to your Composer file and execute composer update.

  • Add this line to the bottom of your app's config/bootstrap.php:

    Plugin::load('Wouter0100/Opauth', ['routes' => true, 'bootstrap' => true]);
    
  • Create a config/opauth.php file with the URL you wish to use for handeling the authentication data after opauth has run:

    <?php
    
    $config['Opauth']['CompleteURL'] = '/auth/complete';
    

    You may want to add config/opauth.php to your gitignore, as the file will contain sensitive information.

  • Load strategies using Composer for Opauth 1.0.0.

    Append configuration for strategies at your config/opauth.php file as follows:

    // Using Facebook strategy as an example
    $config['Opauth']['Strategy']['Facebook'] = [
         'app_id' => 'YOUR FACEBOOK APP ID',
         'app_secret' => 'YOUR FACEBOOK APP SECRET'
    ];
    
  • Go to /auth/facebook to authenticate with Facebook, and similarly for other strategies that you have loaded.

  • After validation, user will be redirected to '/auth/complete' (or whatever you chose in the opauth.php config file) with validated auth response data retrievable available at $this->response->data.

    To route a controller to handle the response, at your app's config/routes.php, add a connector, for example:

    $routes->connect(
        '/auth/complete',
        ['controller' => 'Users', 'action' => 'complete']
    );
    

    You can then work with the authentication data at, say src/Controller/UsersController.php as follows:

    <?php
    namespace App\Controller;
    
    use App\Controller\AppController;
    
    class UsersController extends AppController
    {
        public function complete()
        {
            debug($this->request->data);
        }
    }
    

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

Issues & questions

Used this plugin in your CakePHP project? Let us know!

License

The MIT License
Copyright © 2012-2015 U-Zyn Chua (http://uzyn.com), further mentained by Wouter van Os (http://wouter0100.nl)

FAQs

Package last updated on 02 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts