JMSSecurityExtraBundle
JMSSecurityExtraBundle copied to clipboard
ConfigDriver enhancements
Replaces PR #147 having made a mess in commits. Recent commits in upstream repo have been merged.
Instead of defaulting DI-configuration of method access control to equivalent of PreAuthorize annotation, this pull request provides support for more specific method access control policies.
DI configuration entries can now use the following configuration keys
pre_authorizesecuresecure_paramsecure_returnrun_as
and use them in the same way they are used with annotations.
Here is an example of valid YAML DI configuration
jms_security_extra:
# ...
method_access_control:
# retro-compatible with good'ol DI configuration
'UserManager::delete$': 'hasRole("FOO")'
'TestBundle:Crud:add': 'hasRole("FOO")'
'TestBundle:Foo:exception': 'permitAll'
'TestBundle:Foo:.*': 'hasRole("MOO")'
# key may be anything.
# It is not used if 'pattern' is set
AdvancedConfig:
pattern: 'TestBundle:Crud:delete$'
pre_authorize: 'hasRole("FOO")'
-
pattern: 'TestBundle:*'
secure_return:
roles:
- ROLE_SUPERADMIN
'SecretSecureService::secure*' # Name stands as 'pattern' if needed
run_as: 'ROLE_NINJA'
This pull request fully solves
- Issue #142 and #143
- Issue #140
This pull request hacks around
- Issue #145
looks like you messed your rebase: you merge your rebased branch with your older branch instead of forcing the push