【发布时间】:2012-04-27 07:39:45
【问题描述】:
所以我能够让 Apache Shiro 在 Vaadin 上与 Guice 一起工作(感谢 ShiroWebModule)。
Shiro 注释(@RequiresAuthentication、@RequiresPermission)仅适用于主 Vaadin Application 类和自定义类内部。它们在 CustomComponent/Window 类中不起作用。
我尝试通过 injector.getInstance 将 Window 类与提供程序一起注入 Application 类,但它仍然无法正常工作...
我是 Guice 和 Shiro 的新手,所以也许我遗漏了什么?
为什么它适用于其他自定义类?这按预期工作(抛出异常)
public class TestClassImpl implements TestClass {
@Override
public void doSomeWork() {
//this will throw an exception as expected
test();
}
@RequiresAuthentication
public void test() {
}
}
这并没有按预期工作(方法被执行,Apache Shiro 注解被忽略):
public class LoginView extends CustomComponent {
public LoginWindow() {
setCompositionRoot(mainLayout);
//this will execture but it should not
test();
}
@RequiresAuthentication
public void test() {
}
}
【问题讨论】: