Class FormAuthenticate
An authentication adapter for AuthComponent. Provides the ability to authenticate using POST data. Can be used by configuring AuthComponent to use it via the AuthComponent::$authenticate setting.
{{{ $this->Auth->authenticate = array( 'Form' => array( 'scope' => array('User.active' => 1) ) ) }}}
When configuring FormAuthenticate you can pass in settings to which fields, model and additional conditions are used. See FormAuthenticate::$settings for more information.
- BaseAuthenticate
- FormAuthenticate
Since: 2.0
See: AuthComponent::$authenticate
Copyright: Copyright 2005-2011, Cake Software Foundation, Inc. (http://cakefoundation.org)
License: License (http://www.opensource.org/licenses/mit-license.php)
Location: Cake/Controller/Component/Auth/FormAuthenticate.php
Inherited Properties
Method Summary
-
authenticate() public
Authenticates the identity contained in a request. Will use the
settings.userModel
, andsettings.fields
to find POST data that is used to find a matching record in thesettings.userModel
. Will return false if there is no post data, either username or password is missing, of if the scope conditions have not been met.
Method Detail
authenticate() public ¶
authenticate( CakeRequest
$request , CakeResponse
$response )
Authenticates the identity contained in a request. Will use the settings.userModel
, and settings.fields
to find POST data that is used to find a matching record in the settings.userModel
. Will return false if
there is no post data, either username or password is missing, of if the scope conditions have not been met.
Parameters
-
CakeRequest
$request - The request that contains login information.
-
CakeResponse
$response - Unused response object.
Returns
False on login failure. An array of User data on success.
Methods inherited from BaseAuthenticate
__construct() public ¶
__construct( ComponentCollection
$collection , array $settings )
Constructor
Parameters
-
ComponentCollection
$collection - The Component collection used on this request.
- array $settings
- Array of settings to use.
_findUser() protected ¶
_findUser( string $username , string $password )
Find a user record using the standard options.
Parameters
- string $username
- The username/identifier.
- string $password
- The unhashed password.
Returns
Either false on failure, or an array of user data.
_password() protected ¶
_password( string $password )
Hash the plain text password so that it matches the hashed/encrypted password in the datasource.
Parameters
- string $password
- The plain text password.
Returns
The hashed form of the password.
getUser() 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
Either false or an array of user information