-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[SecurityBundle] Allow for custom request matchers #20272
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,7 +163,9 @@ private function addAccessControlSection(ArrayNodeDefinition $rootNode) | |
->prototype('array') | ||
->fixXmlConfig('ip') | ||
->fixXmlConfig('method') | ||
->fixXmlConfig('role') | ||
->children() | ||
->scalarNode('matcher')->defaultNUll()->end() | ||
->scalarNode('requires_channel')->defaultNull()->end() | ||
->scalarNode('path') | ||
->defaultNull() | ||
|
@@ -180,9 +182,6 @@ private function addAccessControlSection(ArrayNodeDefinition $rootNode) | |
->prototype('scalar')->end() | ||
->end() | ||
->scalarNode('allow_if')->defaultNull()->end() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this CS should be applied to a lower branch |
||
->end() | ||
->fixXmlConfig('role') | ||
->children() | ||
->arrayNode('roles') | ||
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end() | ||
->prototype('scalar')->end() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -195,13 +195,11 @@ private function createAuthorization($config, ContainerBuilder $container) | |
)); | ||
|
||
foreach ($config['access_control'] as $access) { | ||
$matcher = $this->createRequestMatcher( | ||
$container, | ||
$access['path'], | ||
$access['host'], | ||
$access['methods'], | ||
$access['ips'] | ||
); | ||
if (null !== $access['matcher']) { | ||
$matcher = new Reference($access['matcher']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. the currently created matcher is configured by many props in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im not sure about the "right" approach here. Perhaps we should talk config/API first. But we could do DX-wise i think As goes for |
||
} else { | ||
$matcher = $this->createRequestMatcher($container, $access['path'], $access['host'], $access['methods'], $access['ips']); | ||
} | ||
|
||
$attributes = $access['roles']; | ||
if ($access['allow_if']) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
defaultNUll
should bedefaultNull
😄