Skip to content

Instantly share code, notes, and snippets.

@BinaryKitten
Created January 30, 2014 18:08
Show Gist options
  • Select an option

  • Save BinaryKitten/8714898 to your computer and use it in GitHub Desktop.

Select an option

Save BinaryKitten/8714898 to your computer and use it in GitHub Desktop.
public function getServiceConfig()
{
return array(
'factories' => array(
'auth' => function(ServiceManager $sm) {
$db = $sm->get('Zend\Db\Adapter\Adapter');
$authAdapter = new \Zend\Authentication\Adapter\DbTable\CallbackCheckAdapter(
$db,
'users',
'username',
'password',
function($hash, $password) use($sm) {
$cfg = $sm->get('config');
$options = $cfg['auth\Config'];
return password_verify($hash, $password);
}
);
$storage = new \Zend\Authentication\Storage\Session('Authentication');
$service = new \Zend\Authentication\AuthenticationService($storage, $authAdapter);
return $service;
}
)
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment