Jfinal-ext shiro注解不起作用
我现在环境Jfinal2.0 + Jfinal-ext ,
其中用到了ext的shiro,也自定义了Reaml,现在的问题是ext的shiro注解无效,不起作用(使用shiro.ini文件中的urls配置和在代码里直接调用curuser.isPermitted("user")都是正常的,唯独使用shiro注解时却不起作用,晕。。。)
下面是一些信息,还请帮忙看看,是什么问题引起的
1.web.xml
<listener>
<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
</listener>
<filter>
<filter-name>ShiroFilter</filter-name>
<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ShiroFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter>
<filter-name>jfinal</filter-name>
<filter-class>com.jfinal.core.JFinalFilter</filter-class>
<init-param>
<param-name>configClass</param-name>
<param-value>com.juli.configuration.JuLiConfig</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>jfinal</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2.配置
public void configPlugin(Plugins me) {
loadPropertyFile("db.properties");
C3p0Plugin c3p0Plugin = new C3p0Plugin(getProperty("jdbcUrl"),getProperty("user"), getProperty("passwd"));
me.add(c3p0Plugin);
/*ActiveRecordPlugin arp = new ActiveRecordPlugin(c3p0Plugin);
me.add(arp);*/
me.add(new SqlInXmlPlugin());
ShiroPlugin shiroplugin = new ShiroPlugin(this.routes);
me.add(shiroplugin);
3.shiro.ini
[main]
#realm
myRealm =com.juli.common.shiro.JuLiShiroRealm
securityManager.realm = $myRealm
#cache
shiroCacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
shiroCacheManager.cacheManagerConfigFile = classpath:ehcache-shiro.xml
securityManager.cacheManager = $shiroCacheManager
#session
sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionDAO.activeSessionsCacheName = shiro-activeSessionCache
sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager
securityManager.sessionManager.globalSessionTimeout = 360000
shiro.loginUrl =/
authc.loginUrl = /
perms.unauthorizedUrl = /
[urls]
/ = anon
/login = anon
/** = authc
4.Controller代码
public class SysuserController extends Controller{
@RequiresPermissions(value={"user"})//现无此权限,应会进入登录页面,但不起作用
public void index()
{
Subject curuser = SecurityUtils.getSubject();
/*if(curuser.isPermitted("user"))
{
renderText("有权限");
return;
}else
{
renderText("无权限");
return;
}*/
/*SysUser user = (SysUser)curuser.getPrincipal();
renderText(user.getStr("loginname")+"-"+user.getStr("name"));*/
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有人回复下吗?