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'));
}
}