-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
json_login_ldap
in chain with json_login
and new authenticator
#41892
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
cc @wouterj |
Hi, maybe it's another issue, but I encounter same thing with |
here when the parent method is called, the base authenticator is replaced another with a different config. Parent method have hardcoded service id |
I can reproduce this issue aswell. I have the following firewall config:
Then you can see that the wrong options are injected into the "normal" form login authenticator.
|
I also can produce the problem with SH 6.0.1: When using only the |
The problem is exactly in the place @diversantvlz linked. There is an optimization in place which shares the form_login config for all authenticators for all firewalls and that simply does not work and it breaks all the ldap decorators aswell. |
With symfony/security-bundle v6.0.3 the same error now occurs when disabling the new authentication manager. |
Same problem here chaining
For now I changed back for the old way to configure it disabling the |
Does it take a big effort to solve this issue ? |
Is there any news about fix this problem ? |
Talking for myself, the reasons for not looking into this "naturally" are that I don't suffer from this bug and it's about ldap which I don't use and for which I don't have the required setup to reproduce locally. If you can, please have a look into this so you can come up with a patch to propose in a PR. |
@B4rb4ross4 's example is good.
Changing @chalasr This is not really an LDAP issue, just a naming clash... Solutions:
(Nr 1 might not be an option, as it would break success and failure handlers) |
json_login_ldap
in chain with json_login
and new authenticator
If I read correctly, the issue is not adding a symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/LdapFactoryTrait.php Line 49 in ae3b078
Anyone up for a PR? |
@wouterj Unfortunately it is not that easy. The line you mentioned is fine, because The problem is that the
The inner authenticator is created here: symfony/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/Factory/LdapFactoryTrait.php Line 42 in ae3b078
Which makes sense, always call the parent, either form_login, json_login etc, but this created inner service will have the same name as a regular form_login authenticator.
This change fixes it, but the |
Thanks for the explanation, this is clear to me now. I've written a failing test case showing what is going wrong: 6.3...wouterj:symfony:issue-41892/ldap-decoration Let us know in this thread if you're working on fixing this in Symfony (you can use my commit as a start) :) |
Hey, thanks for your report! |
Hi, I find a workaround by developing a custom |
Hey, thanks for your report! |
Anyone up to work on this? |
Closing the first pull request to fix the bug on the earlier mantained branch, aKa 5.4 🤗 There's one issue about the test, given the |
Is there a way to implement both form_login for in memory users and form_login_ldap for ldap users on same firewall @MindfulPol @oliverreese @franzwilding @wouterj @Padam87 @OskarStark |
Having the same issue on 6.3.12 as @vasanth-kumar-m-y, the authenticator does not seem to work with both in place. The form_login sets the fail response and no later authenticator is called. That way in_memory and LDAP can not co-exist. |
Hello, I have this security.yaml: providers:
local_users:
entity:
class: App\Entity\User
property: username
ldap_users:
ldap:
service: Symfony\Component\Ldap\Ldap
base_dn: '%env(LDAP_BASE_DN)%'
search_dn: '%env(LDAP_SEARCH_DN)%'
search_password: '%env(LDAP_SEARCH_PASSWORD)%'
uid_key: "uid"
all_users:
chain:
providers: ['ldap_users', 'local_users']
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
main:
lazy: true
provider: all_users
entry_point: form_login
form_login_ldap:
service: Symfony\Component\Ldap\Ldap
login_path: app_login
check_path: app_login
enable_csrf: true
dn_string: '%env(LDAP_BASE_DN)%'
query_string: '(uid={user_identifier})'
search_dn: '%env(LDAP_SEARCH_DN)%'
search_password: '%env(LDAP_SEARCH_PASSWORD)%'
form_login:
login_path: app_login
check_path: app_login
enable_csrf: true But everytime, form_login sets the fail response and the form_login_ldap is never called... Anyone succeeded with that ? |
It doesn't work on same firewall. Need to use Custom Authenticator https://symfony.com/doc/current/security/custom_authenticator.html |
Hey, thanks for your report! |
yes @carsonbot, it worked using Custom Authenticator https://symfony.com/doc/current/security/custom_authenticator.html |
Symfony version(s) affected: 5.3.2
Description
a combination of json_login_ldap and json_login will not work when the new authentication manager is enabled. They both
on their own work properly but not in combination. When new authentication manager is disabled they work properly together
in a chain.
How to reproduce
see attached repository with 4 different configuration cases to reproduce:
https://github.com/oliverreese/symfony-security-ldap-login
Possible Solution
Additional context
The text was updated successfully, but these errors were encountered: