8000 [Security] Service "security.authentication.provider.simple_form.secured_area": The index "3" is not in the range [0, 2]. · Issue #26753 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Security] Service "security.authentication.provider.simple_form.secured_area": The index "3" is not in the range [0, 2]. #26753

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

Closed
andreybolonin opened this issue Apr 3, 2018 · 6 comments

Comments

@andreybolonin
Copy link
Contributor
andreybolonin commented Apr 3, 2018
Q A
Bug report? yes
Feature request? no
BC Break report? no
RFC? no
Symfony version 4.0.7

bin/console -v

In Definition.php line 262:
                                                                                                                  
  [Symfony\Component\DependencyInjection\Exception\OutOfBoundsException]                                          
  Service "security.authentication.provider.simple_form.secured_area": The index "3" is not in the range [0, 2].  
                                                                                                                  

Exception trace:
 Symfony\Component\DependencyInjection\Definition->replaceArgument() at /Users/andreybolonin/www/asat/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:150
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->doResolveDefinition() at /Users/andreybolonin/www/asat/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:58
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->resolveDefinition() at /Users/andreybolonin/www/asat/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:39
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->processValue() at /Users/andreybolonin/www/asat/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:60
 Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->processValue() at /Users/andreybolonin/www/asat/vendor/symfony/dependency-injection/Compiler/ResolveChildDefinitionsPass.php:31
 Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass->processValue() at /Users/andreybolonin/www/asat/vendor/symfony/dependency-injection/Compiler/AbstractRecursivePass.php:39
 Symfony\Component\DependencyInjection\Compiler\AbstractRecursivePass->process() at /Users/andreybolonin/www/asat/vendor/symfony/dependency-injection/Compiler/Compiler.php:95
 Symfony\Component\DependencyInjection\Compiler\Compiler->compile() at /Users/andreybolonin/www/asat/vendor/symfony/dependency-injection/ContainerBuilder.php:713
 Symfony\Component\DependencyInjection\ContainerBuilder->compile() at /Users/andreybolonin/www/asat/vendor/symfony/http-kernel/Kernel.php:513
 Symfony\Component\HttpKernel\Kernel->initializeContainer() at /Users/andreybolonin/www/asat/vendor/symfony/http-kernel/Kernel.php:125
 Symfony\Component\HttpKernel\Kernel->boot() at /Users/andreybolonin/www/asat/vendor/symfony/framework-bundle/Console/Application.php:64
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /Users/andreybolonin/www/asat/vendor/symfony/console/Application.php:143
 Symfony\Component\Console\Application->run() at /Users/andreybolonin/www/asat/bin/console:39

On 4.0.6 works perfectly.
security.yaml

# To get started with security, check out the documentation:
# https://symfony.com/doc/current/security.html
security:
    encoders:
        App\Entity\User:
            algorithm: bcrypt
            cost: 13

    role_hierarchy:
        ROLE_ADMIN: [ROLE_SELLER, ROLE_BUYER, ROLE_BROKER, ROLE_MANAGER, ROLE_ACCOUNTANT]
        ROLE_MANAGER: ~
        ROLE_ACCOUNTANT: ~

    # https://symfony.com/doc/current/security.html#b-configuring-how-users-are-loaded
    providers:
        our_db_provider:
            entity:
                class: App\Entity\User
                property: email
    firewalls:
        # disables authentication for assets and the profiler, adapt it according to your needs
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false

        secured_area:
            pattern: ^/(admin|cabinet|backoffice)
            anonymous: ~
            provider: our_db_provider
            logout_on_user_change: true
            simple_form:
                login_path: /admin/login
                check_path: /admin/login_check
                authenticator: App\Security\PasswordAuthenticator
                default_target_path: after_login
                require_previous_session: false
            logout:
                path:   /admin/logout
                target: /admin/login

    access_control:
        - { path: ^/admin/login, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
        - { path: ^/admin, role: [ROLE_ADMIN, ROLE_MANAGER, ROLE_ACCOUNTANT] }
        - { path: ^/cabinet, role: [ROLE_SELLER, ROLE_BUYER, ROLE_BROKER, ROLE_MANAGER, ROLE_ACCOUNTANT] }
        - { path: ^/backoffice, role: ROLE_ADMIN }
@andreybolonin andreybolonin changed the title Service "security.authentication.provider.simple_form.secured_area" [Security] Service "security.authentication.provider.simple_form.secured_area" Apr 3, 2018
@andreybolonin andreybolonin changed the title [Security] Service "security.authentication.provider.simple_form.secured_area" [Security] Service "security.authentication.provider.simple_form.secured_area": The index "3" is not in the range [0, 2]. Apr 3, 2018
@friizer
Copy link
friizer commented Apr 3, 2018

in the file
vendor\symfony\security-bundle\Resources\config\security_listeners.xml::198
service definition missing 4. argument ?

@nicolas-grekas
Copy link
Member

Can you please confirm that #26762 fixes the issue?

@friizer
Copy link
friizer commented Apr 3, 2018

In our case yes, thats why I wrote, but iam not the reporter :)

@andreybolonin
Copy link
Contributor Author

@dmaicher
Copy link
Contributor
dmaicher commented Apr 3, 2018

Can also confirm that #26762 fixes the issue for me.

@Jarablus
Copy link
Jarablus commented Apr 4, 2018

Same bug and fix it with #26762

nicolas-grekas added a commit that referenced this issue Apr 4, 2018
…cation.provider.simple (i3or1s, chalasr)

This PR was merged into the 2.8 branch.

Discussion
----------

[SecurityBundle] Add missing argument to security.authentication.provider.simple

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #26753
| License       | MIT
| Doc PR        | -

Created PR in relation to a conversation in [PR](#26762) #26762

Commits
-------

c82c2f1 [SecurityBundle] Add test for simple authentication config
1b26aac [SecurityBundle] Add missing argument to security.authentication.provider.simple
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants
0