naguib
naguib

Reputation: 85

How to allow access only to a local subnet using access control in symfony 2?

Assuming I have /localnetwork, I want only to give access to the local network which usually has ips in this range 10.4.X.X

security:
    firewalls:
      localnetwork:
        pattern:  ^/localnetwork
        anonymous: ~

access_control:
    - { path: ^/localnetwork, roles: IS_AUTHENTICATED_ANONYMOUSLY, ips : [ '10.4.X.X'] }
    - { path: ^/localnetwork, roles: ROLE_NO_ACCESS}

So the question is : How can it be done in symfony . what should I add instead of 10.4.X.X ?

Upvotes: 3

Views: 968

Answers (1)

Carlos Granados
Carlos Granados

Reputation: 11351

Symfony accepts a subnet in CIDR notation. In your case you can use 10.4.0.0/16

Upvotes: 5

Related Questions