@RequiresRoles("user")注解不生效,可以进入方法中,但是不会调用doGetAuthorizationInfo方法,但是在方法中使用subject.checkRole("user");可以调用到doGetAuthorizationInfo方法。
10 回复
加了
<dependency>
<groupId>org.nutz</groupId>
<artifactId>nutz-integration-shiro</artifactId>
<version>1.r.63</version>
</dependency>
<dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-all</artifactId>
<version>1.3.0</version>
@SetupBy(value = EntrySetup.class, args = "ioc:entrySetup")
@IocBy(type = ComboIocProvider.class,
args = { "*js", "ioc/",
"*anno",
"com.oriente.jackfruit",
"*tx"})
@Modules(scanPackage = true)
@ChainBy(args={"chain.js"})// Insert CorsProcessor to enable CORS access
@IocBean
@At("/")
@Ok("json")
@Fail("http:500")
public class EntryModule extends BaseModule{
@At
public String foo(String args) {
return "foo"+args;
}
{
"default" : {
"ps" : [
"org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor",
"org.nutz.mvc.impl.processor.EncodingProcessor",
"org.nutz.mvc.impl.processor.ModuleProcessor",
"org.nutz.mvc.impl.processor.ActionFiltersProcessor",
"org.nutz.mvc.impl.processor.AdaptorProcessor",
"org.nutz.mvc.impl.processor.MethodInvokeProcessor",
"ioc:corsProcessor", // Insert CorsProcessor to enable CORS access
"org.nutz.mvc.impl.processor.ViewProcessor"
],
"error" : 'org.nutz.mvc.impl.processor.FailProcessor'
}
}
把shiro的处理器加上
{
"default" : {
"ps" : [
"org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor",
"org.nutz.mvc.impl.processor.EncodingProcessor",
"org.nutz.mvc.impl.processor.ModuleProcessor",
"org.nutz.integration.shiro.NutShiroProcessor", // 加入这一行
"org.nutz.mvc.impl.processor.ActionFiltersProcessor",
"org.nutz.mvc.impl.processor.AdaptorProcessor",
"org.nutz.mvc.impl.processor.MethodInvokeProcessor",
"ioc:corsProcessor", // Insert CorsProcessor to enable CORS access
"org.nutz.mvc.impl.processor.ViewProcessor"
],
"error" : 'org.nutz.mvc.impl.processor.FailProcessor'
}
}
添加回复
请先登陆