FOC\Authenticate\Auth\TokenAuthenticate::__construct PHP Method

__construct() public method

Settings for this object. - parameter The url parameter name of the token. - header The token header value. - userModel The model name of the User, defaults to Users. - fields The fields to use to identify a user by. Make sure 'token' has been added to the array - scope Additional conditions to use when looking up and authenticating users, i.e. ['Users.is_active' => 1]. - contain Extra models to contain. - continue Continue after trying token authentication or just throw the unauthorized exception. - unauthorized Exception name to throw or a status code as an integer.
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.
    public function __construct(ComponentRegistry $registry, $config)
    {
        $this->_registry = $registry;
        $this->config(['parameter' => '_token', 'header' => 'X-ApiToken', 'fields' => ['token' => 'token', 'password' => 'password'], 'continue' => false, 'unauthorized' => 'Cake\\Network\\Exception\\BadRequestException']);
        $this->config($config);
        if (empty($this->_config['parameter']) && empty($this->_config['header'])) {
            throw new Exception(__d('authenticate', 'You need to specify token parameter and/or header'));
        }
    }