Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 8327720

Browse files
committed
[documentaion] add security
1 parent 9ecadee commit 8327720

File tree

1 file changed

+46
-27
lines changed

1 file changed

+46
-27
lines changed

docs/plugins/security.rst

Lines changed: 46 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,57 @@
1-
.. note::
2-
3-
This documentation is under construction, more to come soon
4-
5-
6-
71
Security
82
========
93

104
Features
11-
~~~~~~~~
12-
13-
- Insert here the different feature available for this plugin
5+
--------
146

15-
Configuration
16-
~~~~~~~~~~~~~
17-
18-
- Insert the yaml configuration for the DI
7+
- Add security and access control to your application
8+
- The current implementation is based on the `Security Component`_ from the Symfony2 framework.
199

20-
.. code-block:: yaml
10+
.. note::
2111

22-
element.plugins.cache:
23-
cache_control:
24-
- { "path": "^.*\\.(txt|jpg|png|gif|xls|doc|docx)$", "Cache-Control": ['public', 's-maxage=14212800']}
25-
- { "path": "^(blog|gallery).*", "Cache-Control": ['public', 's-maxage=3600']}
26-
- { "path": "^.*\\.rss", "Cache-Control": ['public', 's-maxage=3600']}
27-
- { "path": "^contact.*", "Cache-Control": ['private', 'must-revalidate']}
28-
- { "path": "^/$", "Cache-Control": ['public', 's-maxage=3600']}
12+
For now, there is only one authentication implemented: the http basic.
2913

30-
Events
31-
~~~~~~
14+
Configuration
15+
-------------
3216

33-
- List event or entry points for this plugin
17+
There is no configuration option. You only need to enable the plugin by adding this line into the IoC configuration file.
3418

35-
Architecture
36-
~~~~~~~~~~~~
19+
.. code-block:: yaml
3720
38-
- Provide information about how the feature is implemented
21+
element.plugins.security:
22+
role_hierarchy:
23+
ROLE_PUBLIC: [IS_AUTHENTICATED_ANONYMOUSLY]
24+
ROLE_ADMIN: [ROLE_PUBLIC, ROLE_USER]
25+
26+
providers:
27+
in_memory:
28+
users:
29+
- {'username': 'admin', 'password': 'admin', roles: ['ROLE_ADMIN']}
30+
31+
firewalls:
32+
private:
33+
pattern: ^/(admin|api)(.*)
34+
http_basic:
35+
provider: element.plugins.security.provider.in_memory
36+
# login_path: /admin/login
37+
# use_forward: false
38+
# check_path: /admin/login_check
39+
# failure_path: null
40+
# logout:
41+
# path: /admin/logout
42+
anonymous: false # allow anonymous connection
43+
44+
public:
45+
pattern: "^/.*"
46+
anonymous: true # allow anonymous connection
47+
48+
access_control:
49+
- { path: ^/admin/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
50+
- { path: ^/admin/logout$, role: IS_AUTHENTICATED_ANONYMOUSLY }
51+
- { path: ^/admin/login-check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
52+
- { path: ^/(admin|api), role: ROLE_ADMIN }
53+
- { path: ^/.*, role: ['IS_AUTHENTICATED_ANONYMOUSLY'] }
54+
55+
56+
57+
.. _Security Component:: http://symfony.com/doc/current/book/security.html

0 commit comments

Comments
 (0)