You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Description
The api_provider is being used to refresh the user for the main firewall instead of the api_provider.
Is it me, or a bug in Symfony?
How to reproduce
Security.yml:
providers:
api_provider:
id: App\Security\APIProvideruser_provider:
id: App\Security\UserProviderfirewalls:
dev:
# assets and profilerpattern: ^/(_(profiler|wdt)|css|images|js)/security: falseapi:
host: ^(api\.mydomain\.com|crm-api\.localhost|dev-api\.mydomain\.com)$stateless: trueprovider: api_providerguard:
authenticators:
- App\Security\APIAuthenticator#the main firewallmain:
#guard will run the form authenticator on each requestguard:
authenticators:
- App\Security\FormAuthenticatorprovider: user_providerswitch_user: { role: ROLE_IMPERSONATE_USER, parameter: _switch_user }anonymous: ~#the path /logout should logout our user and send them to /loginlogout:
path: /logouttarget: /login
The text was updated successfully, but these errors were encountered:
HTMLGuyLLC
changed the title
FormAuthenticator not called after initial login
FormAuthenticator not called after initial login when multiple user providers
Dec 19, 2018
HTMLGuyLLC
changed the title
FormAuthenticator not called after initial login when multiple user providers
UserProvider not called after initial login when multiple user providers
Dec 19, 2018
I see in the ContextListener. refreshUser() in my APIProvider needs to throw an exception to be skipped. Doesn't make much sense since the firewall doesn't apply to this host or url pattern. Why would you still test the userprovider? Since my api firewall is stateless, I didn't think I had to do anything inside my refreshUser method. Kinda unintuitive, don't you think? I suggest you filter down the user providers by the firewalls that apply to the current request before looping through and testing them OR at least call the supportsClass() method before trying to refreshUser()...
catch (UnsupportedUserException $e) {
// let's try the next user provider
I created a crappy pull request showing a simplistic solution. I really think it would be best to skip user providers that don't apply to the current firewall though. #29653
Uh oh!
There was an error while loading. Please reload this page.
Symfony version(s) affected: 4.2.1
Description
The api_provider is being used to refresh the user for the main firewall instead of the api_provider.
Is it me, or a bug in Symfony?
How to reproduce
Security.yml:
The text was updated successfully, but these errors were encountered: