<commit_before>.. note::

    This documentation is under construction, more to come soon



Security
========

Features
~~~~~~~~

  - Insert here the different feature available for this plugin

Configuration
~~~~~~~~~~~~~

  - Insert the yaml configuration for the DI

.. code-block:: yaml

    element.plugins.cache:
        cache_control:
            - { "path": "^.*\\.(txt|jpg|png|gif|xls|doc|docx)$",    "Cache-Control": ['public', 's-maxage=14212800']}
            - { "path": "^(blog|gallery).*",    "Cache-Control": ['public', 's-maxage=3600']}
            - { "path": "^.*\\.rss",            "Cache-Control": ['public', 's-maxage=3600']}
            - { "path": "^contact.*",           "Cache-Control": ['private', 'must-revalidate']}
            - { "path": "^/$",                  "Cache-Control": ['public', 's-maxage=3600']}

Events
~~~~~~

 - List event or entry points for this plugin

Architecture
~~~~~~~~~~~~

 - Provide information about how the feature is implemented
<commit_msg>[documentaion] add security<commit_after>Security
========

Features
--------

  - Add security and access control to your application
  - The current implementation is based on the `Security Component`_ from the Symfony2 framework.

.. note::

    For now, there is only one authentication implemented: the http basic.

Configuration
-------------

There is no configuration option. You only need to enable the plugin by adding this line into the IoC configuration file.

.. code-block:: yaml

    element.plugins.security:
        role_hierarchy:
            ROLE_PUBLIC:      [IS_AUTHENTICATED_ANONYMOUSLY]
            ROLE_ADMIN:       [ROLE_PUBLIC, ROLE_USER]

        providers:
            in_memory:
                users:
                    - {'username': 'admin', 'password': '<PASSWORD>', roles: ['ROLE_ADMIN']}

        firewalls:
            private:
                pattern:            ^/(admin|api)(.*)
                http_basic:
                    provider:       element.plugins.security.provider.in_memory
                    # login_path:     /admin/login
                    # use_forward:    false
                    # check_path:     /admin/login_check
                    # failure_path:   null
                # logout:
                    # path:           /admin/logout
                anonymous:          false  # allow anonymous connection

            public:
                pattern:            "^/.*"
                anonymous:          true    # allow anonymous connection

        access_control:
            - { path: ^/admin/login$,       role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/admin/logout$,      role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/admin/login-check$, role: IS_AUTHENTICATED_ANONYMOUSLY }
            - { path: ^/(admin|api),        role: ROLE_ADMIN }
            - { path: ^/.*,                 role: ['IS_AUTHENTICATED_ANONYMOUSLY'] }



.. _Security Component:: http://symfony.com/doc/current/book/security.html
{'fraction_non_alphanumeric': 0.13881491344873503, 'fraction_numerical': 0.006990679094540613, 'mean_word_length': 1.8322337417530632, 'pattern_counts': {'":': 10, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '890599', 'n_tokens_mistral': 870, 'n_tokens_neox': 815, 'n_words': 206}