Announcement Announcement Module
No announcement yet.
sample code for domain object instance security interceptor? Page Title Module
Move Remove Collapse
This topic is closed
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • sample code for domain object instance security interceptor?

    The documentation has an example of how to use MethodSecurityInterceptor to secure business beans that are obtained from Spring context via ProxyFactoryBean.

    I would like to apply the same method-level security to the domain object instances returned from DAO layer (rather than obtained from Spring context as beans) and I don't see an example code for this.

    I assume that I'll have to write an interceptor that programmatically (rather than declaratively) creates a proxy for each domain instance that needs to be secured and return the proxy to the consumer that is going to subsequently access the properties of the domain object.

    I'm sure this is very common scenario, so is there any sample code for this that already exists?


  • #2
    You can approach this any other way you would with Spring. Acegi Security is essentially just an AOP Alliance MethodInterceptor, so if you can wire one of those, you'll be fine. People sometimes use prototype beans for this purpose.

    Alternatively, use the AspectJ integration which is a way of wiring instances with advices without needing to get them from the IoC container.