Abstract password hashing class
Base Authentication class with common methods and properties.
Abstract base authorization adapter for AuthComponent.
Basic Authentication adapter for AuthComponent.
Provides Basic HTTP authentication support for AuthComponent. Basic Auth will authenticate users against the configured userModel and verify the username and passwords match.
In your controller's components array, add auth + the required config
public $components = [
'Auth' => [
'authenticate' => ['Basic']
]
];
You should also set AuthComponent::$sessionKey = false; in your AppController's
beforeFilter() to prevent CakePHP from sending a session cookie to the client.
Since HTTP Basic Authentication is stateless you don't need a login() action in your controller. The user credentials will be checked on each request. If valid credentials are not provided, required authentication headers will be sent by this authentication provider which triggers the login dialog in the browser/client.
You may also want to use $this->Auth->unauthorizedRedirect = false;.
By default, unauthorized users are redirected to the referrer URL,
AuthComponent::$loginAction, or '/'. If unauthorizedRedirect is set to
false, a ForbiddenException exception is thrown instead of redirecting.
An authorization adapter for AuthComponent. Provides the ability to authorize using a controller callback. Your controller's isAuthorized() method should return a boolean to indicate whether or not the user is authorized.
public function isAuthorized($user)
{
if ($this->request->getParam('admin')) {
return $user['role'] === 'admin';
}
return !empty($user);
}
The above is simple implementation that would only authorize users of the 'admin' role to access admin routing.
Default password hashing class.
Digest Authentication adapter for AuthComponent.
Provides Digest HTTP authentication support for AuthComponent.
In your controller's components array, add auth + the required config
public $components = [
'Auth' => [
'authenticate' => ['Digest']
]
];
You should also set AuthComponent::$sessionKey = false; in your AppController's
beforeFilter() to prevent CakePHP from sending a session cookie to the client.
Since HTTP Digest Authentication is stateless you don't need a login() action in your controller. The user credentials will be checked on each request. If valid credentials are not provided, required authentication headers will be sent by this authentication provider which triggers the login dialog in the browser/client.
You may also want to use $this->Auth->unauthorizedRedirect = false;.
This causes AuthComponent to throw a ForbiddenException exception instead of
redirecting to another page.
DigestAuthenticate requires a special password hash that conforms to RFC2617.
You can generate this password using DigestAuthenticate::password()
$digestPass = DigestAuthenticate::password($username, $password, env('SERVER_NAME'));
If you wish to use digest authentication alongside other authentication methods,
it's recommended that you store the digest authentication separately. For
example User.digest_pass could be used for a digest password, while
User.password would store the password hash for use with other methods like
Basic or Form.
A password hasher that can use multiple different hashes where only one is the preferred one. This is useful when trying to migrate an existing database of users from one password type to another.
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 config.
$this->Auth->authenticate = [
'Form' => [
'finder' => ['auth' => ['some_finder_option' => 'some_value']]
]
]
When configuring FormAuthenticate you can pass in config to which fields, model and additional conditions are used. See FormAuthenticate::$_config for more information.
Builds password hashing objects
Password hashing class that use weak hashing algorithms. This class is intended only to be used with legacy databases where passwords have not been migrated to a stronger algorithm yet.