Extends
lithium\core\Adaptable
Manually authenticate a user with the given set of data. Rather than checking a user's
credentials, this method allows you to manually specify a user for whom you'd like to
initialize an authenticated session.
By default, before writing the data to the session, the `set()` method of the named
configuration's adapter receives the data to be written, and has an opportunity to modify
or reject it.
Parameters
- string $name The name of the adapter configuration to.
- array $data The user data to be written to the session.
- array $options Any additional session-writing options. These may override any options set by the default session configuration for `$name`.
Returns
array Returns the array of data written to the session, or `false` if the adapter rejects the data.Source
public static function set($name, $data, array $options = array()) {
$params = compact('name', 'data', 'options');
return static::_filter(__FUNCTION__, $params, function($self, $params) {
extract($params);
$config = $self::invokeMethod('_config', array($name));
$session = $config['session'];
if ($data = $self::adapter($name)->set($data, $options)) {
$session['class']::write($session['key'], $data, $options + $session['options']);
return $data;
}
return false;
});
}