Commit Graph

48717 Commits

Author SHA1 Message Date
Nicolas Grekas add867020a [DI] skip preloading dependencies of non-preloaded services 2020-04-23 23:57:44 +02:00
Nicolas Grekas 5a7208481d [Cache] skip APCu in chains when the backend is disabled 2020-04-23 23:50:38 +02:00
Nicolas Grekas abb463c749 [DI] fix definition and usage of AbstractArgument 2020-04-23 22:40:01 +02:00
Nicolas Grekas ea69f77b70 bug #36523 [Form] apply automatically step=1 for datetime-local input (ottaviano)
This PR was merged into the 3.4 branch.

Discussion
----------

[Form] apply automatically step=1 for datetime-local input

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | ~
| License       | MIT
| Doc PR        |

this PR just reapplies the same fix from `TimeType` (https://github.com/symfony/symfony/pull/10777 thanks @tucksaun) to `DateTimeType`.

### before:
```php
'widget' => 'single_text',
'with_seconds' => true,
```
![image](https://user-images.githubusercontent.com/4582866/79972699-a5369500-8496-11ea-8272-d43b68ff49b5.png)

### after:
```php
'widget' => 'single_text',
'with_seconds' => true,
```
![image](https://user-images.githubusercontent.com/4582866/79972801-cbf4cb80-8496-11ea-9af5-b193445b1f1d.png)

Commits
-------

3c24cfecdd [Form] apply automatically step=1 for datetime-local input
2020-04-23 22:22:05 +02:00
Nicolas Grekas 2d7b0b8dad bug #36519 [FrameworkBundle] debug:autowiring: Fix wrong display when using class_alias (weaverryan)
This PR was merged into the 4.4 branch.

Discussion
----------

[FrameworkBundle] debug:autowiring: Fix wrong display when using class_alias

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | None
| License       | MIT
| Doc PR        | not needed

Imagine that `FooInterface` is an alias, but it is deprecated and so has a `class_alias` to `BarInterface`. Currently, `debug:autowiring` will actually print that's the autowiring alias is `BarInterface`, despite there being no such id in the container.

@nicolas-grekas originally (on purpose) made the 2nd argument to `Descriptor::getClassDescription()` be passed by reference *for* this exact feature - 56aab09b01 - but I can't figure out why. This change (which effectively removes the by-reference modifying) made no existing tests fail.

Discovered this because the whole deprecated`Doctrine\Common\Persistence\ManagerRegistry` vs newer `Doctrine\Persistence\ManagerRegistry` causes the issue.

Thanks!

Commits
-------

d34b437ce0 Fixing a bug where class_alias would cause incorrect items in debug:autowiring
2020-04-23 22:17:53 +02:00
Thomas Calvet fc6cf3d3c6 [DX] Show the ParseException message in YAML file loaders 2020-04-23 16:16:02 +02:00
Nicolas Grekas 7d55151ff4 [DI] fix lazy factory code generation 2020-04-23 15:09:13 +02:00
Fabien Potencier bbbf80f60b minor #36546 [Mailer] Add a comment to avoid more wrong PRs on this piece of code (fabpot)
This PR was merged into the 4.4 branch.

Discussion
----------

[Mailer] Add a comment to avoid more wrong PRs on this piece of code

| Q             | A
| ------------- | ---
| Branch?       | 4.4 <!-- see below -->
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | Numerous bogus PRs <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Commits
-------

444e616f6b [Mailer] Add a comment to avoid more wrong PRs on this piece of code
2020-04-23 14:42:49 +02:00
Fabien Potencier 444e616f6b [Mailer] Add a comment to avoid more wrong PRs on this piece of code 2020-04-23 14:41:43 +02:00
Robin Chalas 83b37e8010 feature #36525 Improve SQS interoperability (jderusse)
This PR was squashed before being merged into the 5.1-dev branch (closes #36525).

Discussion
----------

Improve SQS interoperability

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | NA
| License       | MIT
| Doc PR        | NA

The Symfony Messenger component provides a SerializerInterface to encode/decode the `Envelope`, this can be used to improve the Interoperability (see [article from jolicode](https://jolicode.com/blog/symfony-messenger-et-linteroperabilite) (french))

Sadly, the current implementation of SQS adapter json_encode the elements of the `Envelope` (`string body` + `string[] headers`) and store everything in the SQS message `Body`. That partially defect the interoperability: 3rd party have to also wrap (unwrap) message form json_encoded Body.

This PR leverage the AWS SQS `Body` and `MessageAttribute` properties to store message information:

```yaml
# before
SQS Message:
  Body: {"body": "hello world", "headers": {"foo": "bar"}}
  MessageAttributes: {}

# after
SQS Message:
  Body: hello world
  MessageAttributes:
    foor: bar
```

Commits
-------

00d84c125e Improve SQS interoperability
2020-04-23 11:06:03 +02:00
Jérémy Derussé 00d84c125e Improve SQS interoperability 2020-04-23 11:05:32 +02:00
Robin Chalas f2f82d1e14 minor #36531 [Mailer] Don't dispatch MessageEvent twice (chalasr)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Mailer] Don't dispatch MessageEvent twice

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Introduced in 829566cdea

Commits
-------

fc4be4822a [Mailer] Don't dispatch MessageEvent twice
2020-04-22 17:47:45 +02:00
Robin Chalas fc4be4822a [Mailer] Don't dispatch MessageEvent twice 2020-04-22 17:34:22 +02:00
Dimitri Gritsajuk 3c24cfecdd [Form] apply automatically step=1 for datetime-local input 2020-04-22 12:34:32 +02:00
Nicolas Grekas a2f0bf89d7 minor #36522 [FrameworkBundle] remove getContainer overwrites in tests (Tobion)
This PR was merged into the 5.0 branch.

Discussion
----------

[FrameworkBundle] remove getContainer overwrites in tests

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | no
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       |
| Doc PR        |

Since 5.0 the parent implementation throws an exception anyway making the overwrites obsolete, see https://github.com/symfony/symfony/pull/31202

Commits
-------

5ef9390b2f remove getContainer overwrites in tests
2020-04-22 11:08:16 +02:00
Tobias Schultze 5ef9390b2f remove getContainer overwrites in tests
Since 5.0 the parent implementation throws an exception anyway making the overwrites obsolete, see https://github.com/symfony/symfony/pull/31202
2020-04-22 02:36:07 +02:00
Nicolas Grekas 119ba3b742 bug #36454 [DependencyInjection][ServiceSubscriber] Support late aliases (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[DependencyInjection][ServiceSubscriber] Support late aliases

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

A service subscriber that references a service that is aliased after optimization passes (after ResolveReferencesToAliasesPass technically) end up being dumped with the real service and not the alias.

I would consider it a bug but @nicolas-grekas told me it's a feature for him, this is why I'm submitting this on master.

@nicolas-grekas, feel free to close this one and open with your solution since you definitely know the subject better.

Commits
-------

24150370c3 [DependencyInjection][ServiceSubscriber] Support late aliases
2020-04-21 23:46:25 +02:00
Fabien Potencier 829566cdea [Mailer] Avoid reusing the same var names 2020-04-21 23:44:24 +02:00
Fabien Potencier 418c8479b0 minor #36509 [OptionsResolver] remove not needed BC layer (xabbuh)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[OptionsResolver] remove not needed BC layer

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Commits
-------

1452619a52 remove not needed BC layer
2020-04-21 23:43:03 +02:00
Nicolas Grekas 33392442e7 fix merge (ter) 2020-04-21 23:41:31 +02:00
Fabien Potencier 22f1076375 bug #36162 [Profiler] Fix profiler nullable string type (mRoca)
This PR was merged into the 5.0 branch.

Discussion
----------

[Profiler] Fix profiler nullable string type

| Q             | A
| ------------- | ---
| Branch?       | 5.0
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets | n/a
| License | MIT
| Doc PR | -

This PR fixes nullable string types in setter for the Profile class.

The detected issue comes from [the Profiler class](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpKernel/Profiler/Profiler.php#L149) :

```php
$profile->setIp($request->getClientIp()); // string or null
```

The corresponding return types for the Profile getters are allready good:
```php
    /**
     * Returns the IP.
     *
     * @return string|null The IP
     */
    public function getIp()
    {
        return $this->ip;
    }
```

Commits
-------

b5d406117d Fix profiler nullable string type
2020-04-21 23:40:38 +02:00
Nicolas Grekas 7ff6fb0b21 fix merge (bis) 2020-04-21 23:40:12 +02:00
Nicolas Grekas 5105062e7a fix merge 2020-04-21 23:38:17 +02:00
Nicolas Grekas 670e601d19 Merge branch '5.0'
* 5.0:
  fix merge
2020-04-21 23:19:50 +02:00
Nicolas Grekas ebc90fb0c5 Merge branch '4.4' into 5.0
* 4.4:
  fix merge
2020-04-21 23:19:41 +02:00
Nicolas Grekas 15d2b77632 fix merge 2020-04-21 23:19:23 +02:00
Nicolas Grekas 7ce2f2401a Merge branch '5.0'
* 5.0:
  [FrameworkBundle] Fix session.attribute_bag service definition
  [Routing] Remove unused properties from the Route annotation
  [Routing] Add missing _locale requirements
  Update LdapBindAuthenticationProvider.php
  Add reproducer to for hit after update expire cacheItem
  [Cache] fix FilesystemTagAwareAdapter failing when a tag link preexists
2020-04-21 23:06:40 +02:00
Nicolas Grekas 4042cc49d1 Merge branch '4.4' into 5.0
* 4.4:
  [FrameworkBundle] Fix session.attribute_bag service definition
  [Routing] Remove unused properties from the Route annotation
  [Routing] Add missing _locale requirements
  Update LdapBindAuthenticationProvider.php
  Add reproducer to for hit after update expire cacheItem
  [Cache] fix FilesystemTagAwareAdapter failing when a tag link preexists
2020-04-21 23:02:50 +02:00
Nicolas Grekas 0ed6cfd412 Merge branch '3.4' into 4.4
* 3.4:
  [FrameworkBundle] Fix session.attribute_bag service definition
  Update LdapBindAuthenticationProvider.php
2020-04-21 23:01:55 +02:00
Nicolas Grekas 08ded7fed6 bug #36498 [Security/Core] fix escape for username in LdapBindAuthenticationProvider.php (stoccc)
This PR was merged into the 3.4 branch.

Discussion
----------

[Security/Core] fix escape for username in LdapBindAuthenticationProvider.php

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| License       | MIT

I think that when we call `ldap_search()` as definitely it will do the `$this->ldap->query()` call, the proper filter applied should be `LdapInterface::ESCAPE_FILTER` as documented in
https://www.php.net/manual/en/function.ldap-escape.php while `LdapInterface::ESCAPE_DN` should be used for `dn` only

This simple change should fix, I'm sorry if I'm wrong.

Commits
-------

4bda68a9a2 Update LdapBindAuthenticationProvider.php
2020-04-21 22:51:56 +02:00
Nicolas Grekas 6642f09053 bug #36506 [FrameworkBundle] Fix session.attribute_bag service definition (fancyweb)
This PR was merged into the 3.4 branch.

Discussion
----------

[FrameworkBundle] Fix session.attribute_bag service definition

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | https://github.com/symfony/symfony/issues/36465
| License       | MIT
| Doc PR        | -

It looks like in https://github.com/symfony/symfony/pull/36063, the fact the the `getAttributeBag` method is private was forgotten. It cannot be used as the factory method. I guess we can make it public. Should it maybe marked `@internal`?

Commits
-------

76072c6424 [FrameworkBundle] Fix session.attribute_bag service definition
2020-04-21 22:46:18 +02:00
Robin Chalas f8b86df6af fix tests 2020-04-21 22:24:20 +02:00
Robin Chalas 80444e8d87 minor #36520 [Security] Apply left-over review comments from #33558 (wouterj)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Security] Apply left-over review comments from #33558

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | n/a

This applies the review comments of @noniagriconomie in #33558. It's mostly doc fixes and one extra security-safeguard by resetting the plaintext password early (similair to what is done in `PasswordCredentials`).

Commits
-------

be3a9a93f0 Applied left-over review comments from #33558
2020-04-21 22:18:35 +02:00
Wouter de Jong be3a9a93f0 Applied left-over review comments from #33558 2020-04-21 22:14:49 +02:00
Nicolas Grekas 60245d94aa bug #36500 [Routing][PrefixTrait] Add the _locale requirement (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing][PrefixTrait] Add the _locale requirement

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

9fd62f79fb [Routing] Add missing _locale requirements
2020-04-21 21:59:53 +02:00
Laurent Masforné 1331584fa1 [String] Add locale-sensitive map for slugging symbols 2020-04-21 21:55:25 +02:00
Ryan Weaver d34b437ce0 Fixing a bug where class_alias would cause incorrect items in debug:autowiring 2020-04-21 14:42:49 -04:00
Robin Chalas 6b682bfcc5 bug #36518 [Security] Fix missing nullable in CsrfTokenBadge (sstok)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Security] Fix missing nullable in CsrfTokenBadge

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       |
| License       | MIT
| Doc PR        |

Related to #33558 I noticed a minor 🤏  bug with the method return-type.

Commits
-------

5cb633c0dd Update CsrfTokenBadge.php
2020-04-21 18:49:50 +02:00
Sebastiaan Stok 5cb633c0dd
Update CsrfTokenBadge.php 2020-04-21 17:08:27 +02:00
Fabien Potencier e36ea501a7 bug #36517 [Notifier] Fix error handling for Free mobile (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Fix error handling for Free mobile

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Looks like the error handling code for Free mobile is a copy/paste from Twilio.

/cc @noniagriconomie

Commits
-------

6167ce4961 [Notifier] Fix error handling for Free mobile
2020-04-21 16:39:06 +02:00
Fabien Potencier 6167ce4961 [Notifier] Fix error handling for Free mobile 2020-04-21 16:08:57 +02:00
Fabien Potencier 2235be0864 feature #36516 [Notifier] Throw an exception when the Slack DSN is not valid (fabpot)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Throw an exception when the Slack DSN is not valid

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes-ish
| New feature?  | yes-ish <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets       | n/a <!-- prefix each issue number with "Fix #", if any -->
| License       | MIT
| Doc PR        | n/a

Improved errors in case of a DSN issue.
+ proper error for the Slack DSN when path is empty (will help catch when people haven't updated their Slack DSN for 5.1).

Commits
-------

6b1a64a642 [Notifier] Throw an exception when the Slack DSN is not valid
2020-04-21 15:48:22 +02:00
Fabien Potencier 5a9481784c Fix wrong version in composer.json 2020-04-21 15:43:00 +02:00
Fabien Potencier a89a2a8893 Fix package name 2020-04-21 15:29:37 +02:00
Fabien Potencier 2a92dd3728 minor #36504 [Routing] Remove unused properties from the Route annotation (fancyweb)
This PR was merged into the 4.4 branch.

Discussion
----------

[Routing] Remove unused properties from the Route annotation

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

From what I see those properties are totally unused.

Commits
-------

9ac1c76fd5 [Routing] Remove unused properties from the Route annotation
2020-04-21 15:21:27 +02:00
Fabien Potencier 6b1a64a642 [Notifier] Throw an exception when the Slack DSN is not valid 2020-04-21 15:15:11 +02:00
Fabien Potencier 4cc605537f feature #35690 [Notifier] Add Free Mobile notifier (noniagriconomie)
This PR was merged into the 5.1-dev branch.

Discussion
----------

[Notifier] Add Free Mobile notifier

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | Implements https://github.com/symfony/symfony-docs/pull/13025#pullrequestreview-352447344
| License       | MIT
| Doc PR        | Will document if accepted (see **Usage** below)

## Add a new notifier (SMS) with the French Free Mobile provider.

It is a **special notifier** as it **only send the SMS to the self user**,
but I think it can be **useful for notification alerting purposes** (the way I use it already, and plan to use it with the component)

---

**Provider doc:** (🇫🇷 sorry)

https://mobile.free.fr/moncompte/index.php?page=options

<img width="716" alt="1" src="https://user-images.githubusercontent.com/13205768/74357784-b55c3500-4dc0-11ea-95ba-19ded062e800.png">

<img width="431" alt="2" src="https://user-images.githubusercontent.com/13205768/74357786-b7be8f00-4dc0-11ea-837e-b922c20e9a2e.png">

---

**Usage:**

```
// .env file
FREEMOBILE_DSN=freemobile://LOGIN:PASSWORD@default?phone=PHONE
```

where:
 - `LOGIN` is your Free Mobile login
 - `PASSWORD` is the token displayed in the config panel
- `PHONE` is your Free Mobile phone number

```yaml
// config/packages/notifiers.yaml file
framework:
    notifier:
        texter_transports:
            freemobile: '%env(FREEMOBILE_DSN)%'
```

Then you can then use it like documented here https://symfony.com/doc/current/notifier/texters.html

ℹ️ As this is a special notifier, the `PHONE` provided inside the DSN mut be the same used [here](https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Notifier/Message/SmsMessage.php#L31) for `$phone` value

---

Voilà!

Commits
-------

1b8709ee72 Add Free Mobile notifier
2020-04-21 15:13:45 +02:00
Fabien Potencier 1abdcbb205 feature #33558 [Security] AuthenticatorManager to make "authenticators" first-class security (wouterj)
This PR was squashed before being merged into the 5.1-dev branch.

Discussion
----------

[Security] AuthenticatorManager to make "authenticators" first-class security

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | yes
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | tbd

The tl;dr
---

The old authentication listener + authentication provider system was replaced by a new "authenticator" system (similar to Guard authentication). All existing "auth systems" (e.g. `form_login` are now written as an "authenticator" in core).

Instead of each "authentication system" registering its own listener in the `Firewall`, there is now only one listener: `AuthenticatorManagerListener`

* `Firewall` -> executes `AuthenticatorManagerListener`
* `AuthenticatorManagerListener` -> calls `AuthenticatorManager`
* `AuthenticatorManager` -> calls each authenticator

This PR contains *no deprecations* and the "new system" is *marked as experimental*. This allows to continue to develop the new Security system during the 5.x release cycle without disturbing Symfony users. In 5.4, we can deprecate "old" Security and remove it completely in 6.0.

Important Decisions
---

* A) **The new authentication manager - `AuthenticatorManager` - now dispatches 3 important "hook" events**:

  * `VerifyAuthenticatorCredentialsEvent`: occurs at the point when a "password" needs to be checked. Allows us to centralize password checking, CSRF validation, password upgrading and the "user checker" logic.
  * `LoginSuccessEvent`: Dispatched after a successful authentication. E.g. used by remember me listener.
  * `LoginFailedEvent`: Dispatched after an unsuccessful authentication. Also used by remember me (and in theory could be used for login throttling).

* B) **`getCredentials()`, `getUser()` and `checkCredentials()` methods from old Guard are gone: their logic is centralized**.
   Authenticators now have an `authenticate(Request $request): PassportInterface` method. A passport contains the user object, the credentials and any other add-in Security badges (e.g. CSRF):

   ```php
   public function authenticate(Request $request): PassportInterface
   {
       return new Passport(
           $user,
           new PasswordCredentials($request->get('_password')),
           [
               new CsrfBadge($request->get('_token'))
           ]
       );
   }
   ```

   All badges (including the credentials) need to be resolved by listeners to `VerifyAuthenticatorCredentialsEvent`. There is build-in core support for the following badges/credentials:

   * `PasswordCredentials`: validated using the password encoder factory
   * `CustomCredentials`: allows a closure to do credentials checking
   * `CsrfTokenBadge`: automatic CSRF token verification
   * `PasswordUpgradeBadge`: enables password migration
   * `RememberMeBadge`: enables remember-me support for this authenticator

* C) **`AuthenticatorManager` contains all logic to authenticate**
  As authenticators always relate to HTTP, the `AuthenticatorManager` contains all logic to authenticate. It has three methods, the most important two are:

  * `authenticateRequest(Request $request): TokenInterface`: Doing what is previously done by a listener and an authentication provider;
  * `authenticateUser(UserInterface $user, AuthenticatorInterface $authenticator, Request $request, array $badges = [])` for manual login in e.g. a controller.

* D) **One AuthenticatorManager per firewall**
  In the old system, there was 1 authentication manager containing all providers and each firewall had a specific firewall listener. In the new system, each firewall has a specific authentication manager.

* E) **Pre-authentication tokens are dropped.**
  As everything is now handled inside `AuthenticatorManager` and everything is stored in the Security `Passport`, there was no need for a token anymore (removing lots of confusion about what information is inside the token).

  This change deprecates 2 authentication calls: one in `AuthorizationChecker#isGranted()` and one in `AccessListener`.  These seem now to be mis-used to reload users (e.g. re-authenticate the user after you change their roles). This (some "way" to change a user's roles *without* logging them out) needs to be "fixed"/added in another PR.

* F) **The remember me service now uses *all* user providers**
  Previously, only user providers of authentication providers listening on that firewall were used. This change is due to practical reasons and we don't think it is common to have 2 user providers supporting the same user instance. In any case, you can always explicitly configure the user provider under `remember_me`.

* G) **Auth Providers No Longer Clear the Token on Auth Failure**
  Previously, authentication providers did `$this->tokenStorage->setToken(null)` upon authentication failure. This is not yet implemented: our reasoning is that if you've authenticated successfully using e.g. the login form, why should you be logged out if you visit the same login form and enter wrong credentials?
  The pre-authenticated authenticators are an exception here, they do reset the token upon authentication failure, just like the old system.

* H) **CSRF Generator Service ID No Longer Configurable**
  The old Form login authentication provider allowed you to configure the CSRF generator service ID. This is no longer possible with the automated CSRF listener. This feature was introduced in the first CSRF commit and didn't get any updates ever since, so we don't think this feature is required. This could also be accomplished by checking CSRF manually in your authenticator, instead of using the automated check.

Future Considerations
---

* Remove Security sub-components: Move CSRF to `Symfony\Component\Csrf` (just like mime); Deprecated Guard; Put HTTP + Core as `symfony/security`. This means moving the new classes to `Symfony\Component\Security`

* Convert LDAP to the new system

* This is fixed (and merged) by #36243 <s>There is a need for some listeners to listen for events on one firewall, but not another (e.g. `RememberMeListener`). This is now fixed by checking the `$providerKey`. We thought it might be nice to introduce a feature to the event dispatcher:</s>

  * <s>Create one event dispatcher per firewall;</s>
  * <s>Extend the `kernel.event_subscriber` tag, so that you can optionally specify the dispatcher service ID (to allow listening on events for a specific dispatcher);</s>
  * <s>Add a listener that always also triggers the events on the main event dispatcher, in case you want a listener that is listening on all firewalls.</s>

* Drop the `AnonymousToken` and `AnonymousAuthenticator`: Anonymous authentication has never made much sense and complicates things (e.g. the user can be a string). For access control, an anonymous user has the same meaning as an un-authenticated one (`null`). This require changes in the `AccessListener` and `AuthorizationChecker` and probably also a new Security attribute (to replace `IS_AUTHENTICATED_ANONYMOUSLY`). Related issues: #34909, #30609

> **How to test**
> 1. Install the Symfony demo application (or any Symfony application)
> 2. Clone my Symfony fork (`git clone git@github.com:wouterj/symfony`) and checkout my branch (`git checkout security/deprecate-providers-listeners`)
> 3. Use the link utility to link my fork to the Symfony application: `/path/to/symfony-fork/link /path/to/project`
> 4. Enable the new system by setting `security.enable_authenticator_manager` to `true`

Commits
-------

b1e040f311 Rename providerKey to firewallName for more consistent naming
50224aa285 Introduce Passport & Badges to extend authenticators
9ea32c4ed3 Also use authentication failure/success handlers in FormLoginAuthenticator
0fe5083a3e Added JSON login authenticator
7ef6a7ab03 Use the firewall event dispatcher
95edc806a1 Added pre-authenticated authenticators (X.509 & REMOTE_USER)
f5e11e5f32 Reverted changes to the Guard component
ba3754a80f Differentiate between interactive and non-interactive authenticators
6b9d78d5e0 Added tests
59f49b20ca Rename AuthenticatingListener
60d396f2d1 Added automatically CSRF protected authenticators
bf1a452e94 Merge AuthenticatorManager and AuthenticatorHandler
44cc76fec2 Use one AuthenticatorManager per firewall
09bed16d3d Only load old manager if new system is disabled
ddf430fc1e Added remember me functionality
1c810d5d2a Added support for lazy firewalls
7859977324 Removed all mentions of 'guard' in the new system
999ec2795f Refactor to an event based authentication approach
b14a5e8c52 Moved new authenticator to the HTTP namespace
b923e4c4f6 Enabled remember me for the GuardManagerListener
873b949cf9 Mark new core authenticators as experimental
4c06236933 Fixes after testing in Demo application
fa4b3ec213 Implemented password migration for the new authenticators
5efa892395 Create a new core AuthenticatorInterface
50132587a1 Add provider key in PreAuthenticationGuardToken
526f75608b Added GuardManagerListener
a172bacaa6 Added FormLogin and Anonymous authenticators
9b7fddd10c Integrated GuardAuthenticationManager in the SecurityBundle
a6890dbcf0 Created HttpBasicAuthenticator and some Guard traits
c321f4d73a Created GuardAuthenticationManager to make Guard first-class Security
2020-04-21 14:44:22 +02:00
Fabien Potencier 01794d089c
Merge pull request #36514 from fabpot/notifier-still-experimental
[Notifier] Mark the component as experimental in 5.1
2020-04-21 13:53:17 +02:00
Fabien Potencier bc85eb34c7 [Notifier] Mark the component as experimental in 5.1 2020-04-21 13:50:35 +02:00