Programming is hard by Stephan Schmidt

Gabriel for Guice

After fiddling around with the security framework Gabriel I wrote some time back and which I need for Reposita. I thought about combining Gabriel with Google Guice for fun. The only problem was that Gabriel can be used with interceptors to protect methods. How could I get them working with Guice?

I was using Dynaop, the best aop framework for Java, which I wrote a Spring bean factory for to use with Gabriel. For Guice I tried to port it when Bob told me that Guice already supports interceptors :-) So using my AOP alliance interceptors from Gabriel with Guice was a no brainer. Everything worked as excpected. Guice is great.

So protecting methods with annotations is easy now with Gabriel:

public interface SecureObject {

  @NeedsPermission("SET_NAME")
  public void setName(String name);
}

Two things I’m still thinking about are what to call the annotation ? NeedsPermission, Permission, WithPermission? And to get the interface method I currently iterate over all interfaces of the class, any ideas how to do that faster?

Otherwise: http://gabriel.reposita.org/

If you liked this post, subscribe to my free full RSS feed.
Filed under: Java

You can share this post!
Do you want to tell others about this article? Use the social bookmark icons to submit this artice to the service of your choice. Thanks.

Get free updates by email

If you did like this article you can get free updates with your RSS reader, you can follow me on Twitter or get free update to new posts by email. Enter your email:

 
About the author: Stephan has been working as a head of development and CTO. He has experiences in different technologies since 20 years including Java, Rails and Python. Stephans main field of interest is maintainablity and productivity in software development. Want to know more? All views are only his own.

Leave a Reply