aclavijo/cakeopenidconnect

Provide Google OpenId Connect feature for cake php 1.3

Maintainers

👁 AClavijo

Package info

github.com/AClavijo/cakeopenidconnect

Type:cakephp-plugin

pkg:composer/aclavijo/cakeopenidconnect

Statistics

Installs: 98

Dependents: 0

Suggesters: 0

Stars: 1

Open Issues: 0

v0.1.15 2017-09-25 12:37 UTC

Requires (Dev)

None

Suggests

None

Provides

None

Conflicts

None

Replaces

None

MIT 203d37eaa1cf2217a1390650572d3464ee58ff74

  • Antoine Clavijo <antoine.clavijo.woop@gmail.com>

README

This plugin provide Google OpenId Connect to a cake 1.3 Framework.

I try to make the installation easy. So please read the installation part :)

Dependancies

This project include one dependancie:

  • "google/apiclient": "^2.0" 'Documentation'
  • "symfony/yaml" : "3.1.*" 'Documentation'
  • "aclavijo/cakephp-installer-plugin": "0.1.*" Custom composer installer

Installation

via composer

composer require aclavijo/cakeopenidconnect

When you've done the installation, composer will place the plugin in 'app/plugins/openid'

Parameter.yml

you need to create a parameter.yml in app/plugins/openid/config from the parameter.yml.dist

Configuration

#parameters.yml
OpenidConnect:
 client_id: string
 secret_id: string
 scopes: array
 #optionnal
 domains: null|array #default null
 log_path: null|array #default null
 cake_log: false|true #default true
 flash_ctp: string #default flash_bas
  • client_id: client_id provide by google
  • secret_id: client_id provide by google
  • scopes: google openid scope ['openid', 'email', 'profile'] minimum ['openid', 'email']
  • domains: array if you want to only authorize authentification by email address domains (all other will be rejected)
  • log_path: specifie another log file path (Apache for example)
  • cake_log: false to desactivate cake logging
  • flash_ctp: name of the cake 1.3 flash template to display error loggin message

Deploy it on your project

User search fonction

  • In app/models/uilisateur.php, add the following function
 function getUserByPseudo($pseudo)
 {
 $params = array(
 'conditions' => array('Utilisateur.pseudo' => $pseudo)
 );
 $result = $this->find('first', $params);
 
 return $result['Utilisateur'];
 }

(optionnal) add the route to the router

  • in the file app/config/router.php
Router::connect('/openid/oauth/authentification', array('plugin' => 'openid', 'controller' => 'oauth', 'action' => 'authentification'));

Add a connection link

  • In login.ctp:
 echo $html->link('Name your button', array(
 'plugin' => 'openid', 
 'controller' => 'oauth',
 'action' => 'authentification' 
 ), array(
 'class' => 'btn btn-primary'
 )); ?>

To do

  • Implement the log_path feature