PHP Class ADmad\HybridAuth\Auth\HybridAuthAuthenticate

Licensed under The MIT License For full copyright and license information, please see the LICENSE.txt
Inheritance: extends Cake\Auth\BaseAuthenticate, use trait Cake\Event\EventDispatcherTrait
Mostra file Open project: admad/cakephp-hybridauth

Protected Properties

Property Type Description
$_adapter Hybrid_Provider_Model HybridAuth adapter.
$_initDone boolean Whether hybrid auth intialization is done.
$_profileModel Cake\Datasource\RepositoryInterface Social profile model
$_providerProfile Hybrid_User_Profile HybridAuth user profile.
$_userModel Cake\Datasource\RepositoryInterface User model.

Public Methods

Method Description
__construct ( Cake\Controller\ComponentRegistry $registry, array $config ) Constructor
adapter ( Hybrid_Provider_Model $adapter = null ) : Hybrid_Provider_Model | void Get / set hybridauth adapter instance.
authenticate ( Cake\Network\Request $request, Response $response ) : array | boolean Authenticate a user based on the request information.
getUser ( Cake\Network\Request $request ) : array | boolean Check if a provider is already connected, return user record if available.
implementedEvents ( ) : array Returns a list of all events that this authenticate class will listen to.
logout ( Cake\Event\Event $event, array $user ) : void Logout all providers
profile ( Hybrid_User_Profile $profile = null ) : Hybrid_User_Profile | void Get / set hybridauth user profile instance.

Protected Methods

Method Description
_checkProvider ( array $data ) : string | boolean Checks whether provider is supplied.
_getUser ( Hybrid_Provider_Model $adapter ) : array Get user record for HybridAuth adapter and try to get associated user record from your application's database.
_init ( Cake\Network\Request $request ) : void Initialize HybridAuth and this authenticator.
_newUser ( Cake\ORM\Entity $profile ) : Cake\ORM\Entity Get new user entity.
_profileEntity ( Cake\ORM\Entity $profile = null ) : Cake\ORM\Entity Get social profile entity
_query ( string $identifier ) : Query Get query to fetch social profile record.

Method Details

__construct() public method

Constructor
public __construct ( Cake\Controller\ComponentRegistry $registry, array $config )
$registry Cake\Controller\ComponentRegistry The Component registry used on this request.
$config array Array of config to use.

_checkProvider() protected method

Checks whether provider is supplied.
protected _checkProvider ( array $data ) : string | boolean
$data array Data array to check.
return string | boolean Provider name if it exists, false if required fields have not been supplied.

_getUser() protected method

If app user record is not found a 'HybridAuth.newUser' event is dispatched with profile info from HyridAuth. The event listener should create associated user record and return user entity as event result.
protected _getUser ( Hybrid_Provider_Model $adapter ) : array
$adapter Hybrid_Provider_Model Hybrid auth adapter instance.
return array User record

_init() protected method

Initialize HybridAuth and this authenticator.
protected _init ( Cake\Network\Request $request ) : void
$request Cake\Network\Request Request instance.
return void

_newUser() protected method

It dispatches a HybridAuth.newUser event. A listener must return an entity for new user record.
protected _newUser ( Cake\ORM\Entity $profile ) : Cake\ORM\Entity
$profile Cake\ORM\Entity Social profile entity.
return Cake\ORM\Entity User entity.

_profileEntity() protected method

Get social profile entity
protected _profileEntity ( Cake\ORM\Entity $profile = null ) : Cake\ORM\Entity
$profile Cake\ORM\Entity Social profile entity
return Cake\ORM\Entity

_query() protected method

Get query to fetch social profile record.
protected _query ( string $identifier ) : Query
$identifier string Provider's identifier.
return Cake\ORM\Query

adapter() public method

Get / set hybridauth adapter instance.
public adapter ( Hybrid_Provider_Model $adapter = null ) : Hybrid_Provider_Model | void
$adapter Hybrid_Provider_Model Hybrid auth adapter instance
return Hybrid_Provider_Model | void

authenticate() public method

Authenticate a user based on the request information.
public authenticate ( Cake\Network\Request $request, Response $response ) : array | boolean
$request Cake\Network\Request Request to get authentication information from.
$response Cake\Network\Response A response object that can have headers added.
return array | boolean User array on success, false on failure.

getUser() public method

Check if a provider is already connected, return user record if available.
public getUser ( Cake\Network\Request $request ) : array | boolean
$request Cake\Network\Request Request instance.
return array | boolean User array on success, false on failure.

implementedEvents() public method

Returns a list of all events that this authenticate class will listen to.
public implementedEvents ( ) : array
return array List of events this class listens to.

logout() public method

Logout all providers
public logout ( Cake\Event\Event $event, array $user ) : void
$event Cake\Event\Event Event.
$user array The user about to be logged out.
return void

profile() public method

Get / set hybridauth user profile instance.
public profile ( Hybrid_User_Profile $profile = null ) : Hybrid_User_Profile | void
$profile Hybrid_User_Profile Hybrid auth user profile instance
return Hybrid_User_Profile | void

Property Details

$_adapter protected_oe property

HybridAuth adapter.
protected Hybrid_Provider_Model $_adapter
return Hybrid_Provider_Model

$_initDone protected_oe property

Whether hybrid auth intialization is done.
protected bool $_initDone
return boolean

$_profileModel protected_oe property

Social profile model
protected RepositoryInterface,Cake\Datasource $_profileModel
return Cake\Datasource\RepositoryInterface

$_providerProfile protected_oe property

HybridAuth user profile.
protected Hybrid_User_Profile $_providerProfile
return Hybrid_User_Profile

$_userModel protected_oe property

User model.
protected RepositoryInterface,Cake\Datasource $_userModel
return Cake\Datasource\RepositoryInterface