UPDATE I never figured out why the below security.yml file didn't work, but I did learn some stuff along the way that might help someone in the future. I don't know if this 100 percent accurate, but it doesn't appear that the login_path and check_path keys work with route names, you need to use the actual paths (eg /login). Also the provider key should be at the same level in the yaml as pattern and anonymous, rather than under ldapsecure as shown below.
I'm getting this error when trying to configure a custom authentication provider using Symfony 2.6.
Unrecognized options "check_path, login_path, provider" under "security.firewalls.secured_area.ldapsecure"
Here's my security.yml
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
ldap_provider:
id: ldap.security.user.provider
firewalls:
login_firewall:
pattern: ^/app/login$
anonymous: ~
secured_area:
pattern: ^/
ldapsecure:
check_path: app_security_login_check
login_path: app_security_login_path
provider: ldap_provider
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
access_control:
- { path: ^/app/login, roles: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/, roles: ROLE_USER }
The ldapsecure "factory" class exists and if I change the getKey() method to return someone else, it breaks differently, so the ldapsecure is being recognized. But I can't see why it's not accepting check_path, login_path or provider. If I change ldapsecure to form_login, I don't get the error, it's just not using my authentication provider.
So I feel like I'm missing something, but don't know where to look at this point.
In your ldapsecure
factory change the body of addConfiguration
method to the following:
public function addConfiguration(NodeDefinition $node)
{
$node
->children()
->scalarNode('check_path')
->isRequired()
->end()
->scalarNode('login_path')
->isRequired()
->end()
->scalarNode('provider')
->isRequired()
->end()
->end();
}
This should make it work.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.