Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 public function register(DiInterface $di)
 {
     $di->set(self::SERVICE_NAME, function () use($di) {
         $adapter = new \Vegas\Security\Authentication\Adapter\Standard($di->get('userPasswordManager'));
         $adapter->setSessionStorage($di->get('sessionManager')->createScope('auth'));
         $auth = new \Vegas\Security\Authentication($adapter);
         return $auth;
     }, true);
 }
Beispiel #2
0
    $sessionAdapter = new SessionAdapter($config->session->toArray());
    if (!$sessionAdapter->isStarted()) {
        $sessionAdapter->start();
    }
    return $sessionAdapter;
}, true);
$di->set('sessionManager', function () use($di) {
    $session = new Vegas\Session($di->get('session'));
    return $session;
}, true);
/**
 * Password manager for standard user
 */
$di->set('userPasswordManager', '\\Vegas\\Security\\Password\\Adapter\\Standard', true);
/**  authentications **/
//standard user
$di->set('auth', function () use($di) {
    $adapter = new \Vegas\Security\Authentication\Adapter\Standard($di->get('userPasswordManager'));
    $adapter->setSessionStorage($di->get('sessionManager')->createScope('auth'));
    $auth = new \Vegas\Security\Authentication($adapter);
    return $auth;
}, true);
//no credential
$di->set('authNoCredential', function () use($di) {
    $adapter = new \Vegas\Security\Authentication\Adapter\NoCredential();
    $adapter->setSessionStorage($di->get('sessionManager')->createScope('authUser'));
    $auth = new \Vegas\Security\Authentication($adapter);
    return $auth;
}, true);
require "fixtures/BaseUser.php";
\Phalcon\DI::setDefault($di);