Created
January 30, 2014 18:08
-
-
Save BinaryKitten/8714898 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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