Hi

I am having troubles getting my method level annotation back by an interceptor 
to work.

Here is my annotation class:

  | @Target({TYPE, METHOD})
  | @Retention(RUNTIME)
  | @Documented
  | @Interceptors(AuthorizationInterceptor.class)
  | public @interface Authorized {
  |     Permission[] value();
  | }
  | 

Here is my interceptor class

  | public class AuthorizationInterceptor
  | {
  |    @AroundInvoke
  |    public Object checkAuthorization(InvocationContext invocation) throws 
Exception
  |    {
  |        System.out.println("I am inside Authorization Interceptor");
  |        return invocation.proceed();
  |    }
  | }
  | 

I have a stateful session bean in default scope (Conversation) which has this 
Authorized Annotation on a method exposed in the local interface. Code is as 
follows:

  | public class ModelUploadAction implements ModelUpload {
  | @Authorized([EMAIL PROTECTED](name=SecurityConstants.PERM_EDIT_MODELS)})
  |     @TransactionAttribute(REQUIRED)
  |     public String uploadFile() {
  | // Do some stuff
  |    }
  | }
  | 

I expect the echo line "I am inside the Authorization interceptor" to print, 
whenever uploadFile method is invoked as a page action, which is not happening.

I am using Seam 1.0.1GA along with Jboss4.0.4GA

However, if I move the @Authorized annotation to the class level, it works and 
I can see the echo line on the console. 

We are using this mechanism to implement some custom permissions which vary 
depending on the method which is invoked on the session bean. So I can't have 
that annotation at the class level. On the flip side we have a couple of 
scenarios where this annotation needs to be on the class level. That is why the 
annotation is defined to have the capability to present both on the class level 
as well as the method level.

I have also tried to include
@Around( { BijectionInterceptor.class, ValidationInterceptor.class,
        ConversationInterceptor.class, BusinessProcessInterceptor.class })
@Within(RemoveInterceptor.class)
in my inteceptor class to see if that works. But that does not work either.

Could somebody suggest where I am going wrong?

Your help is appreciated.

Thanks
Vimal


View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3997940#3997940

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3997940
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to