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:
parent
ee8a49a32d
commit
e5035e249f
20
app/app.php
20
app/app.php
@ -7,6 +7,7 @@ use Poche\Twig;
|
|||||||
|
|
||||||
use Symfony\Component\Translation\Loader\PoFileLoader;
|
use Symfony\Component\Translation\Loader\PoFileLoader;
|
||||||
use Silex\Provider\SessionServiceProvider;
|
use Silex\Provider\SessionServiceProvider;
|
||||||
|
use Silex\Provider\SecurityServiceProvider;
|
||||||
|
|
||||||
$app = new Silex\Application();
|
$app = new Silex\Application();
|
||||||
|
|
||||||
@ -57,6 +58,25 @@ $app->register(new Silex\Provider\TranslationServiceProvider(), array(
|
|||||||
|
|
||||||
$app->register(new SessionServiceProvider());
|
$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) {
|
$app['translator'] = $app->share($app->extend('translator', function($translator, $app) {
|
||||||
$translator->addLoader('po', new PoFileLoader());
|
$translator->addLoader('po', new PoFileLoader());
|
||||||
|
|
||||||
|
@ -15,7 +15,10 @@ class EntryController
|
|||||||
{
|
{
|
||||||
$entries = $app['entry_api']->getEntries('unread');
|
$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)
|
public function showAction(Request $request, Application $app, $id)
|
||||||
|
Loading…
Reference in New Issue
Block a user