148 lines
4.9 KiB
PHP
Executable file
148 lines
4.9 KiB
PHP
Executable file
<?php
|
|
|
|
/**
|
|
* Copyright 2010 - 2015, Cake Development Corporation (http://cakedc.com)
|
|
*
|
|
* Licensed under The MIT License
|
|
* Redistributions of files must retain the above copyright notice.
|
|
*
|
|
* @copyright Copyright 2010 - 2015, Cake Development Corporation (http://cakedc.com)
|
|
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
|
|
*/
|
|
use Cake\Core\Configure;
|
|
use Cake\Routing\Router;
|
|
|
|
$config = [
|
|
'Users' => [
|
|
//Table used to manage users
|
|
'table' => 'CakeDC/Users.Users',
|
|
//configure Auth component
|
|
'auth' => true,
|
|
//Password Hasher
|
|
'passwordHasher' => '\Cake\Auth\DefaultPasswordHasher',
|
|
//token expiration, 1 hour
|
|
'Token' => ['expiration' => 14400],
|
|
'Email' => [
|
|
//determines if the user should include email
|
|
'required' => true,
|
|
//determines if registration workflow includes email validation
|
|
'validate' => true,
|
|
],
|
|
'Registration' => [
|
|
//determines if the register is enabled
|
|
'active' => false,
|
|
//determines if the reCaptcha is enabled for registration
|
|
'reCaptcha' => true,
|
|
],
|
|
'Tos' => [
|
|
//determines if the user should include tos accepted
|
|
'required' => false,
|
|
],
|
|
'Social' => [
|
|
//enable social login
|
|
'login' => false,
|
|
],
|
|
'Profile' => [
|
|
//Allow view other users profiles
|
|
'viewOthers' => true,
|
|
'route' => ['plugin' => 'CakeDC/Users', 'controller' => 'Users', 'action' => 'profile'],
|
|
],
|
|
'Key' => [
|
|
'Session' => [
|
|
//session key to store the social auth data
|
|
'social' => 'Users.social',
|
|
//userId key used in reset password workflow
|
|
'resetPasswordUserId' => 'Users.resetPasswordUserId',
|
|
],
|
|
//form key to store the social auth data
|
|
'Form' => [
|
|
'social' => 'social'
|
|
],
|
|
'Data' => [
|
|
//data key to store the users email
|
|
'email' => 'email',
|
|
//data key to store email coming from social networks
|
|
'socialEmail' => 'info.email',
|
|
//data key to check if the remember me option is enabled
|
|
'rememberMe' => 'remember_me',
|
|
],
|
|
],
|
|
//Avatar placeholder
|
|
'Avatar' => ['placeholder' => 'CakeDC/Users.avatar_placeholder.png'],
|
|
'RememberMe' => [
|
|
//configure Remember Me component
|
|
'active' => true,
|
|
'Cookie' => [
|
|
'name' => 'remember_me',
|
|
'Config' => [
|
|
'expires' => '1 month',
|
|
'httpOnly' => true,
|
|
]
|
|
]
|
|
],
|
|
],
|
|
//default configuration used to auto-load the Auth Component, override to change the way Auth works
|
|
'Auth' => [
|
|
'flash' => [
|
|
'element' => 'default',
|
|
'key' => 'auth',
|
|
'params' => ['class' => 'alert alert-danger']
|
|
],
|
|
'loginAction' => [
|
|
'plugin' => 'CakeDC/Users',
|
|
'controller' => 'Users',
|
|
'action' => 'login',
|
|
'prefix' => false
|
|
],
|
|
'authenticate' => [
|
|
'all' => [
|
|
'scope' => ['active' => 1]
|
|
],
|
|
'CakeDC/Users.ApiKey',
|
|
'CakeDC/Users.RememberMe',
|
|
'Form',
|
|
],
|
|
'authorize' => [
|
|
'CakeDC/Users.Superuser',
|
|
'CakeDC/Users.SimpleRbac',
|
|
],
|
|
],
|
|
'OAuth' => [
|
|
'path' => ['plugin' => 'CakeDC/Users', 'controller' => 'Users', 'action' => 'socialLogin', 'prefix' => false],
|
|
'providers' => [
|
|
'facebook' => [
|
|
'className' => 'League\OAuth2\Client\Provider\Facebook',
|
|
'options' => [
|
|
'graphApiVersion' => 'v2.5',
|
|
'redirectUri' => Router::url('/auth/facebook', true)
|
|
]
|
|
],
|
|
'twitter' => [
|
|
'options' => [
|
|
'redirectUri' => Router::url('/auth/twitter', true)
|
|
]
|
|
],
|
|
'linkedIn' => [
|
|
'className' => 'League\OAuth2\Client\Provider\LinkedIn',
|
|
'options' => [
|
|
'redirectUri' => Router::url('/auth/linkedIn', true)
|
|
]
|
|
],
|
|
'instagram' => [
|
|
'className' => 'League\OAuth2\Client\Provider\Instagram',
|
|
'options' => [
|
|
'redirectUri' => Router::url('/auth/instagram', true)
|
|
]
|
|
],
|
|
'google' => [
|
|
'className' => 'League\OAuth2\Client\Provider\Google',
|
|
'options' => [
|
|
'userFields' => ['url', 'aboutMe'],
|
|
'redirectUri' => Router::url('/auth/google', true)
|
|
]
|
|
],
|
|
],
|
|
]
|
|
];
|
|
|
|
return $config;
|