I am considering using Spring Security annotations for my application, with the EL (expression language) feature. For example:
@PreAuthorize("hasPermission(#contact, 'admin')")
public void deletePermission(Contact contact, Sid recipient, Permission permission);
I need the EL capability because I have built my own ACL implementation. However, to use this capability with the "#contact" type arguments, the Spring documentation says this:
You can access any of the method arguments by name as expression variables, provided your code has debug information compiled in.
This begs two questions:
- It is acceptable to have a production application commercially distributed with debug info in it?
- If not, is there any way around this?
Thanks for any guidance on this!
I can't find the reference now, but you might be interested to know that Java 8 will include parameter names at all times, even when I believe Java 8 will include parameter names at all times, even in debug mode.
As a workaround you can implement a custom ParameterNameDiscoverer with your own strategy. Here is an example which produces simple numbered names (
arg0
, etc):And configuration:
I guess this wasn´t an option when you approached the problem the first time, but now you can do this
http://docs.spring.io/spring-security/site/docs/current/reference/html/el-access.html#access-control-using-preauthorize-and-postauthorize