This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Security
Fabien Potencier 1e0adf4c21 feature #14721 [Security] Configuring a user checker per firewall (iltar)
This PR was squashed before being merged into the 2.8 branch (closes #14721).

Discussion
----------

[Security] Configuring a user checker per firewall

_Changed my base branch to avoid issues, closed old PR_

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed ticket | #11090 and helps #14673
| License       | MIT
| Doc PR        | symfony/symfony-docs/pull/5530

This pull request adds support for a configurable user checker per firewall. An example could be:

```yml
services:
    app.user_checker:
        class: App\Security\UserChecker
        arguments:
            - "@request_stack"

security:
    firewalls:
        secured_area:
            pattern: ^/
            anonymous: ~
            basic_auth: ~
            user_checker: app.user_checker

```
The above example will use the `UserChecker` defined as `app.user_checker`. If the `user_checker` option is left empty, `security.user_checker` will  be used. If the `user_checkers` option is not defined, it will fall back to the original behavior to not break backwards compatibility and will validate using the existing `UserChecker`: `security.user_checker`.

I left the default argument in the service definitions to be `security.user_checker` to include backwards compatibility for people who for some reason don't have the extension executed. You can obtain the checker for a specific firewall by appending the firewall name to it. For the firewall `secured_area`, this would be `security.user_checker.secured_area`.

Commits
-------

76bc662 [Security] Configuring a user checker per firewall
2015-10-02 14:49:38 +02:00
..
Core [Security] Configuring a user checker per firewall 2015-10-02 14:49:36 +02:00
Csrf Merge branch '2.7' into 2.8 2015-08-24 09:18:02 +02:00
Guard bug #15925 Updating behavior to not continue after an authenticator has set the response (weaverryan) 2015-09-27 11:53:56 +02:00
Http [Security] made tests work for 2.8 and 3.0 2015-10-01 08:20:17 +02:00
Resources/translations Fixed incorrect and inconsistent translations 2015-09-28 10:50:45 +02:00
.gitignore Added missing files .gitignore 2013-07-21 14:12:18 +02:00
CHANGELOG.md [Security] Deprecated supportsAttribute and supportsClass methods 2015-09-25 13:42:48 +02:00
composer.json add dependency required by a replaced package 2015-09-30 18:57:49 +02:00
LICENSE Updated copyright to 2015 2015-01-01 13:56:52 +01:00
phpunit.xml.dist adding Guard tests 2015-09-20 19:24:20 -04:00
README.md Merge branch '2.7' into 2.8 2015-05-12 17:16:46 +02:00

Security Component

Security provides an infrastructure for sophisticated authorization systems, which makes it possible to easily separate the actual authorization logic from so called user providers that hold the users credentials. It is inspired by the Java Spring framework.

Resources

Documentation:

https://symfony.com/doc/2.8/book/security.html

Tests

You can run the unit tests with the following command:

$ cd path/to/Symfony/Component/Security/
$ composer install
$ phpunit