Class BaseAuthenticate
Base Authentication class with common methods and properties.
- BaseAuthenticate implements CakeEventListener
Direct known subclasses
BasicAuthenticate, FormAuthenticateIndirect known subclasses
BlowfishAuthenticate, DigestAuthenticatePackage: Cake\Controller\Component\Auth
Copyright: Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
License: MIT License
Located at Cake/Controller/Component/Auth/BaseAuthenticate.php
Method Detail
__constructsource public
__construct( ComponentCollection $collection , array $settings )
Constructor
Parameters
-
ComponentCollection
$collection
- The Component collection used on this request.
- array
$settings
- Array of settings to use.
_findUsersource protected
_findUser( string|array $username , string $password null )
Find a user record using the standard options.
The $username parameter can be a (string)username or an array containing conditions for Model::find('first'). If the $password param is not provided the password field will be present in returned array.
Input passwords will be hashed even when a user doesn't exist. This helps mitigate timing attacks that are attempting to find valid usernames.
Parameters
- string|array
$username
- The username/identifier, or an array of find conditions.
- string
$password
optional null - The password, only used if $username param is string.
Returns
boolean|array
Either false on failure, or an array of user data.
_passwordsource protected
_password( string $password )
Hash the plain text password so that it matches the hashed/encrypted password in the datasource.
Deprecated
3.0.0 Since 2.4. Use a PasswordHasher class instead.Parameters
- string
$password
- The plain text password.
Returns
string
The hashed form of the password.
authenticatesource abstract public
authenticate( CakeRequest $request , CakeResponse $response )
Authenticate a user based on the request information.
Parameters
-
CakeRequest
$request
- Request to get authentication information from.
-
CakeResponse
$response
- A response object that can have headers added.
Returns
mixed
Either false on failure, or an array of user data on success.
getUsersource public
getUser( CakeRequest $request )
Get a user based on information in the request. Primarily used by stateless authentication systems like basic and digest auth.
Parameters
-
CakeRequest
$request
- Request object.
Returns
mixed
Either false or an array of user information
implementedEventssource public
implementedEvents( )
Implemented events
Returns
array
of events => callbacks.
Implementation of
CakeEventListener::implementedEvents()
logoutsource public
logout( array $user )
Allows you to hook into AuthComponent::logout(), and implement specialized logout behavior.
All attached authentication objects will have this method called when a user logs out.
Parameters
- array
$user
- The user about to be logged out.
passwordHashersource public
passwordHasher( )
Return password hasher object
Returns
AbstractPasswordHasher
Password hasher instance
Throws
CakeException
If password hasher class not found or it does not extend AbstractPasswordHasher
unauthenticatedsource public
unauthenticated( CakeRequest $request , CakeResponse $response )
Handle unauthenticated access attempt.
Parameters
-
CakeRequest
$request
- A request object.
-
CakeResponse
$response
- A response object.
Returns
mixed
Either true to indicate the unauthenticated request has been dealt with and no more action is required by AuthComponent or void (default).
Properties summary
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.7/class-BaseAuthenticate.html