1
0
mirror of https://github.com/moparisthebest/wallabag synced 2024-11-27 03:12:21 -05:00

[add] configuration for authentication

This commit is contained in:
Nicolas Lœuillet 2014-01-23 13:10:33 +01:00
parent ee8a49a32d
commit e5035e249f
2 changed files with 24 additions and 1 deletions

View File

@ -7,6 +7,7 @@ use Poche\Twig;
use Symfony\Component\Translation\Loader\PoFileLoader;
use Silex\Provider\SessionServiceProvider;
use Silex\Provider\SecurityServiceProvider;
$app = new Silex\Application();
@ -57,6 +58,25 @@ $app->register(new Silex\Provider\TranslationServiceProvider(), array(
$app->register(new SessionServiceProvider());
$app->register(new SecurityServiceProvider(), array(
'security.firewalls' => array(
'help' => array('pattern' => '^/help'),
'default' => array(
'pattern' => '^.*$',
'anonymous' => true,
'form' => array('login_path' => '/', 'check_path' => 'login'),
'logout' => array('logout_path' => '/logout'),
'users' => $app->share(function() use ($app) {
return new Poche\User\UserProvider($app['db']);
}),
),
),
'security.access_rules' => array(
array('^/.+$', 'ROLE_USER'),
array('^/help$', ''),
)
));
$app['translator'] = $app->share($app->extend('translator', function($translator, $app) {
$translator->addLoader('po', new PoFileLoader());

View File

@ -15,7 +15,10 @@ class EntryController
{
$entries = $app['entry_api']->getEntries('unread');
return $app['twig']->render('index.twig', array('entries' => $entries));
return $app['twig']->render('index.twig', array(
'error' => $app['security.last_error']($request),
'entries' => $entries,
));
}
public function showAction(Request $request, Application $app, $id)