mkurz/deadbolt-2-java

SubjectPresent.deferred=true does not take effect

Closed this issue · 4 comments

Hi, there

I met a problem where SubjectPresent.deferred=true does not take effect when running Deadbolt 2.5 with Play 2.5.x

Through debugging I found that the problem is probably caused by AbstractDeadboltAction.java line 112:

          if (isDeferred(ctx))
            {
                result = getDeferredAction(ctx).call(ctx);
            }
            else if (!ctx.args.containsKey(IGNORE_DEFERRED_FLAG)
                    && annClass.isAnnotationPresent(Deferrable.class) // <- THIS LINE
                    && (Boolean)annClass.getMethod("deferred").invoke(configuration))
            {
                defer(ctx,
                      this);
                result = delegate.call(ctx);
            }
            else
            {
                result = execute(ctx);
            }

In runtime I found the annClass is a Java Proxy and annClass.isAnnotationPresent(Deferrable.class) always returns false.

Thanks, I'll update this in release 2.5.2.

mkurz commented

I can confirm this bug, fix is here: #57
However in future versions of deadbolt I would remove the deferred feature and replace with something better. I will open an issue which explains why and how we can achieve that.

mkurz commented

One interesting thing is this is broken since deadbolt v2.5 (8a9f978#diff-35cac4df0fca072127e0a8be20d15f8fR108) and just one person was complaining so far.

Looks like not so many people are using the defer feature...

mkurz commented

This is fixed and will land in 2.5.7 and 2.6.4