Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Copy link
Copy link
Closed
@andreybolonin

Description

@andreybolonin
Issue body actions
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 }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.