Skip to content

Commit 9724559

Browse files
committed
feature #38149 [SecurityBundle] Comma separated ips for security.access_control (a-menshchikov)
This PR was squashed before being merged into the 5.2-dev branch. Discussion ---------- [SecurityBundle] Comma separated ips for security.access_control | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | | License | MIT | Doc PR | symfony/symfony-docs#14219 There is currently no way to use env vars to configure `security.access_control` ips with multiple values. Ability to use comma separated ips make it able. Commits ------- 0412e91060 [SecurityBundle] Comma separated ips for security.access_control
2 parents 50d72d1 + 49f9592 commit 9724559

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* Added `FirewallListenerFactoryInterface`, which can be implemented by security factories to add firewall listeners
88
* Added `SortFirewallListenersPass` to make the execution order of firewall listeners configurable by
99
leveraging `Symfony\Component\Security\Http\Firewall\FirewallListenerInterface`
10+
* Added ability to use comma separated ip address list for `security.access_control`
1011

1112
5.1.0
1213
-----

Tests/Functional/app/StandardFormLogin/config.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ imports:
33

44
parameters:
55
env(APP_IP): '127.0.0.1'
6+
env(APP_IPS): '127.0.0.1, ::1'
67

78
security:
89
encoders:
@@ -47,7 +48,9 @@ security:
4748
- { path: ^/secured-by-one-real-ip-with-mask$, ips: '203.0.113.0/24', roles: IS_AUTHENTICATED_ANONYMOUSLY }
4849
- { path: ^/secured-by-one-real-ipv6$, ips: 0:0:0:0:0:ffff:c633:6400, roles: IS_AUTHENTICATED_ANONYMOUSLY }
4950
- { path: ^/secured-by-one-env-placeholder$, ips: '%env(APP_IP)%', roles: IS_AUTHENTICATED_ANONYMOUSLY }
51+
- { path: ^/secured-by-one-env-placeholder-multiple-ips$, ips: '%env(APP_IPS)%', roles: IS_AUTHENTICATED_ANONYMOUSLY }
5052
- { path: ^/secured-by-one-env-placeholder-and-one-real-ip$, ips: ['%env(APP_IP)%', 198.51.100.0], roles: IS_AUTHENTICATED_ANONYMOUSLY }
53+
- { path: ^/secured-by-one-env-placeholder-multiple-ips-and-one-real-ip$, ips: ['%env(APP_IPS)%', 198.51.100.0], roles: IS_AUTHENTICATED_ANONYMOUSLY }
5154
- { path: ^/highly_protected_resource$, roles: IS_ADMIN }
5255
- { path: ^/protected-via-expression$, allow_if: "(is_anonymous() and request.headers.get('user-agent') matches '/Firefox/i') or is_granted('ROLE_USER')" }
5356
- { path: .*, roles: IS_AUTHENTICATED_FULLY }

0 commit comments

Comments
 (0)