Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
929d327d
Commit
929d327d
authored
Jul 22, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added some missing use statements in the security docs (closes #445)
parent
4bd46b80
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
doc/providers/security.rst
doc/providers/security.rst
+6
-3
No files found.
doc/providers/security.rst
View file @
929d327d
...
@@ -176,6 +176,8 @@ Always keep in mind the following two golden rules:
...
@@ -176,6 +176,8 @@ Always keep in mind the following two golden rules:
For the login form to work, create a controller like the following::
For the login form to work, create a controller like the following::
use Symfony\Component\HttpFoundation\Request;
$app->get('/login', function(Request $request) use ($app) {
$app->get('/login', function(Request $request) use ($app) {
return $app['twig']->render('login.html', array(
return $app['twig']->render('login.html', array(
'error' => $app['security.last_error']($request),
'error' => $app['security.last_error']($request),
...
@@ -390,7 +392,7 @@ Using an array of users is simple and useful when securing an admin section of
...
@@ -390,7 +392,7 @@ Using an array of users is simple and useful when securing an admin section of
a personal website, but you can override this default mechanism with you own.
a personal website, but you can override this default mechanism with you own.
The ``users`` setting can be defined as a service that returns an instance of
The ``users`` setting can be defined as a service that returns an instance of
`UserProvider
`UserProvider
Interface
<http://api.symfony.com/master/Symfony/Component/Security/Core/User/UserProviderInterface.html>`_::
<http://api.symfony.com/master/Symfony/Component/Security/Core/User/UserProviderInterface.html>`_::
'users' => $app->share(function () use ($app) {
'users' => $app->share(function () use ($app) {
...
@@ -405,7 +407,6 @@ store the users::
...
@@ -405,7 +407,6 @@ store the users::
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Security\Core\User\User;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Symfony\Component\Security\Core\Exception\UsernameNotFoundException;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Connection;
use Doctrine\DBAL\Schema\Table;
class UserProvider implements UserProviderInterface
class UserProvider implements UserProviderInterface
{
{
...
@@ -450,6 +451,8 @@ class must implement `UserInterface
...
@@ -450,6 +451,8 @@ class must implement `UserInterface
And here is the code that you can use to create the database schema and some
And here is the code that you can use to create the database schema and some
sample users::
sample users::
use Doctrine\DBAL\Schema\Table;
$schema = $conn->getSchemaManager();
$schema = $conn->getSchemaManager();
if (!$schema->tablesExist('users')) {
if (!$schema->tablesExist('users')) {
$users = new Table('users');
$users = new Table('users');
...
@@ -507,7 +510,7 @@ use in your configuration::
...
@@ -507,7 +510,7 @@ use in your configuration::
You can now use it in your configuration like any other built-in
You can now use it in your configuration like any other built-in
authentication provider::
authentication provider::
$app->register(new SecurityServiceProvider(), array(
$app->register(new S
ilex\Provider\S
ecurityServiceProvider(), array(
'security.firewalls' => array(
'security.firewalls' => array(
'default' => array(
'default' => array(
'wsse' => true,
'wsse' => true,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment