Marijn Huizendveld
Marijn Huizendveld

Reputation: 791

Symfony security firewall and access control rule for either an authenticated user or a trusted IP address

I would like to restrict access to certain resources to either authenticated users or clients from trusted IP addresses. Is there an out of the box solution for this or do I need to create a custom Voter for this...?

Upvotes: 1

Views: 828

Answers (1)

DonCallisto
DonCallisto

Reputation: 29912

Into your security.yml file

security:
 #...
 access_control:
  - { path: ^/_internal, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }

You could also secure the entire application, by add some controls into app.php file, but I suppose that this isn't what you need

Upvotes: 2

Related Questions