-1

Is it possible to make it so Symfony will ask for http_basic authentification only if the client IP isn't in the list of the firewall?

If yes, can someone provide me a clear small example on how to do it?

Preciel
  • 2,666
  • 3
  • 20
  • 45

1 Answers1

1

You can do this with access_control:

security:
    # ...

    firewalls:
        main: 
            anonymous: ~
            http_basic: ~

    access_control:
        - { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY,  ip: 127.0.0.1 }
        - { path: ^/, roles: ROLE_USER }
Richard
  • 303
  • 3
  • 9