NutzCN Logo
问答 照着nutz-integration-shiro的demo集成shiro之后有权限注解的请求有过滤拦截,没有注解的请求无过滤拦截
发布于 1610天前 作者 qq_b9dca2ee 1066 次浏览 复制 上一个帖子 下一个帖子
标签:

照着nutz-integration-shiro的demo集成shiro之后有权限注解的请求有过滤拦截,没有注解的请求无过滤拦截,
demo是在https://github.com/nutzam/nutzmore/tree/master/nutz-integration-shiro

shiro.ini 配置如下
[main]

Session管理器,关闭定时校验机制,持久化环境下会非常耗内存

sessionManager = org.apache.shiro.web.session.mgt.DefaultWebSessionManager
sessionManager.sessionValidationSchedulerEnabled = false

带缓存的SessionDAO

sessionDAO = org.apache.shiro.session.mgt.eis.EnterpriseCacheSessionDAO
sessionManager.sessionDAO = $sessionDAO
securityManager.sessionManager = $sessionManager

use R.UU32(), 原生的是UUID,比较长

sessionIdGenerator = org.nutz.integration.shiro.UU32SessionIdGenerator
securityManager.sessionManager.sessionDAO.sessionIdGenerator = $sessionIdGenerator

缓存

cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager.cacheManagerConfigFile=classpath:ehcache.xml
securityManager.cacheManager = $cacheManager

realm声明

daoRealm = com.demo.shiro.realm.DaoRealm
customMatcher =org.nutz.integration.shiro.matcher.MD5PasswordMatcher
daoRealm.credentialsMatcher = $customMatcher
securityManager.realms = $daoRealm

cookie, nutzcn使用超长时间的cookie,所以下面的timeout都很长,单位毫秒:这里10.95天

sessionIdCookie=org.apache.shiro.web.servlet.SimpleCookie
sessionIdCookie.name=sid
sessionIdCookie.maxAge=946080000
sessionIdCookie.httpOnly=true
sessionManager.sessionIdCookie=$sessionIdCookie
sessionManager.sessionIdCookieEnabled=true
sessionManager.globalSessionTimeout=946080000

[urls]
/ = anon
/resources/** = anon
/favicon.ico = anon
/logout = logout

MainModule 配置如下:
@Fail("http:500")
@IocBean
@SetupBy(MainSetup.class) // 启动
@Modules(scanPackage = true)
//@Views({ BeetlViewMaker.class }) // beetl模板
@SessionBy(ShiroSessionProvider.class)
@Encoding(input = "UTF-8", output = "UTF-8")
@ChainBy(type = MainChainMaker.class, args = {}) // 自定义shiro注解处理器
@IocBy(type = ComboIocProvider.class, args = {"*anno", "com.demo", "*tx", "*js", "ioc", "*async"})
public class MainModule {}

还未登录的情况下:
1、有注解的方法日志:
2020-06-19 11:13:02,384 [qtp1864548849-17] DEBUG org.apache.shiro.web.servlet.SimpleCookie - Found 'sid' cookie value [2u7v3gr9vehpdrvd848og6r590]
2020-06-19 11:13:02,386 [qtp1864548849-17] INFO org.apache.shiro.cache.ehcache.EhCacheManager - Using existing EHCache named [shiro-activeSessionCache]
2020-06-19 11:13:02,393 [qtp1864548849-17] DEBUG org.apache.shiro.mgt.DefaultSecurityManager - Resolved SubjectContext context session is invalid. Ignoring and creating an anonymous (session-less) Subject instance.
org.apache.shiro.session.UnknownSessionException: There is no session with id [2u7v3gr9vehpdrvd848og6r590]
at org.apache.shiro.session.mgt.eis.AbstractSessionDAO.readSession(AbstractSessionDAO.java:170)
at org.apache.shiro.session.mgt.eis.CachingSessionDAO.readSession(CachingSessionDAO.java:261)
at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSessionFromDataSource(DefaultSessionManager.java:236)
at org.apache.shiro.session.mgt.DefaultSessionManager.retrieveSession(DefaultSessionManager.java:222)
at org.apache.shiro.session.mgt.AbstractValidatingSessionManager.doGetSession(AbstractValidatingSessionManager.java:118)
at org.apache.shiro.session.mgt.AbstractNativeSessionManager.lookupSession(AbstractNativeSessionManager.java:148)
at org.apache.shiro.session.mgt.AbstractNativeSessionManager.getSession(AbstractNativeSessionManager.java:140)
at org.apache.shiro.mgt.SessionsSecurityManager.getSession(SessionsSecurityManager.java:156)
at org.apache.shiro.mgt.DefaultSecurityManager.resolveContextSession(DefaultSecurityManager.java:456)
at org.apache.shiro.mgt.DefaultSecurityManager.resolveSession(DefaultSecurityManager.java:442)
at org.apache.shiro.mgt.DefaultSecurityManager.createSubject(DefaultSecurityManager.java:338)
at org.apache.shiro.subject.Subject$Builder.buildSubject(Subject.java:846)
at org.apache.shiro.web.subject.WebSubject$Builder.buildWebSubject(WebSubject.java:148)
at org.apache.shiro.web.servlet.AbstractShiroFilter.createSubject(AbstractShiroFilter.java:292)
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:359)
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1629)
at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:533)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190)
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595)
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188)
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168)
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473)
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564)
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166)
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155)
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:219)
at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:126)
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132)
at org.eclipse.jetty.server.Server.handle(Server.java:530)
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:347)
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:256)
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279)
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:102)
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.doProduce(EatWhatYouKill.java:247)
at org.eclipse.jetty.util.thread.strategy.EatWhatYouKill.produce(EatWhatYouKill.java:140)
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:708)
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:626)
at java.lang.Thread.run(Thread.java:748)
2020-06-19 11:13:02,405 [qtp1864548849-17] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/role/has : RoleModule.has(RoleModule.java:183)
2020-06-19 11:13:02,407 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'roleModule'<class com.demo.module.RoleModule>
2020-06-19 11:13:02,407 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get '$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
2020-06-19 11:13:02,408 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=$aop_async
2020-06-19 11:13:02,409 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject($aop_async) in AsyncAopIocLoader@1436389950
2020-06-19 11:13:02,409 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'$aop_async'<interface org.nutz.ioc.aop.config.AopConfigration>
2020-06-19 11:13:02,562 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object '$aop_async' to [app]
2020-06-19 11:13:02,572 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.SimpleAopMaker - Load AopConfigure for anno=org.nutz.ioc.aop.Aop by type=org.nutz.ioc.aop.config.impl.AnnotationAopConfigration
2020-06-19 11:13:02,573 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=roleModule
2020-06-19 11:13:02,574 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(roleModule) in AnnotationIocLoader(packages=[com.demo])
2020-06-19 11:13:02,575 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'roleModule'<class com.demo.module.RoleModule>
2020-06-19 11:13:02,576 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'roleModule' to [app]
2020-06-19 11:13:02,576 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.demo.module.RoleModule without AOP
2020-06-19 11:13:02,609 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'roleService'<class com.demo.service.RoleService>
2020-06-19 11:13:02,611 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=roleService
2020-06-19 11:13:02,612 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(roleService) in AnnotationIocLoader(packages=[com.demo])
2020-06-19 11:13:02,612 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'roleService'<class com.demo.service.RoleService>
2020-06-19 11:13:02,612 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'roleService' to [app]
2020-06-19 11:13:02,613 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.demo.service.RoleService without AOP
2020-06-19 11:13:02,860 [qtp1864548849-17] DEBUG org.nutz.service.EntityService - Get TypeParams for self : com.demo.domain.Role
2020-06-19 11:13:02,861 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'rolePermissionService'<class com.demo.service.RolePermissionService>
2020-06-19 11:13:02,862 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=rolePermissionService
2020-06-19 11:13:02,862 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(rolePermissionService) in AnnotationIocLoader(packages=[com.demo])
2020-06-19 11:13:02,862 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'rolePermissionService'<class com.demo.service.RolePermissionService>
2020-06-19 11:13:02,862 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'rolePermissionService' to [app]
2020-06-19 11:13:02,862 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.demo.service.RolePermissionService without AOP
2020-06-19 11:13:02,866 [qtp1864548849-17] DEBUG org.nutz.service.EntityService - Get TypeParams for self : com.demo.domain.RolePermission
2020-06-19 11:13:02,866 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'config'<>
2020-06-19 11:13:02,866 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=config
2020-06-19 11:13:02,866 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(config) in JsonLoader(paths=[ioc])
2020-06-19 11:13:02,867 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'config'<>
2020-06-19 11:13:02,867 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'config' to [app]
2020-06-19 11:13:02,868 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2020-06-19 11:13:02,976 [qtp1864548849-17] DEBUG org.nutz.resource.Scans - Found 0 resource by src( conf ) , regex( ^.+[.]properties$ )
2020-06-19 11:13:02,976 [qtp1864548849-17] WARN org.nutz.ioc.impl.PropertiesProxy - Could not load resource from conf: folder or file like '^.+[.]properties$' no found in conf
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dao'<>
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=dao
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(dao) in JsonLoader(paths=[ioc])
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'dao'<>
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'dao' to [app]
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dataSource'<>
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=dataSource
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(dataSource) in JsonLoader(paths=[ioc])
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'dataSource'<>
2020-06-19 11:13:02,977 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'dataSource' to [app]
2020-06-19 11:13:03,019 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.alibaba.druid.pool.DruidDataSource without AOP
2020-06-19 11:13:03,528 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'db'<>
2020-06-19 11:13:03,528 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=db
2020-06-19 11:13:03,529 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(db) in JsonLoader(paths=[ioc])
2020-06-19 11:13:03,529 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'db'<>
2020-06-19 11:13:03,529 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'db' to [app]
2020-06-19 11:13:03,529 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class org.nutz.ioc.impl.PropertiesProxy without AOP
2020-06-19 11:13:03,532 [qtp1864548849-17] DEBUG org.nutz.resource.Scans - Found 1 resource by src( datasource ) , regex( ^.+[.]properties$ )
2020-06-19 11:13:03,533 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.PropertiesProxy - load properties from File[E:\ideaIU-2020-1\workspace\mynutz\target\classes\datasource\datasource.properties]
xxxx查询(省略)
2020-06-19 11:13:05,542 [qtp1864548849-17] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/ : MainModule.home(MainModule.java:75)
2020-06-19 11:13:05,543 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'mainModule'<class com.demo.MainModule>
2020-06-19 11:13:05,543 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=mainModule
2020-06-19 11:13:05,543 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(mainModule) in AnnotationIocLoader(packages=[com.demo])
2020-06-19 11:13:05,543 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'mainModule'<class com.demo.MainModule>
2020-06-19 11:13:05,543 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'mainModule' to [app]
2020-06-19 11:13:05,544 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.demo.MainModule without AOP
2020-06-19 11:13:05,548 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'shiroUserService'<class com.demo.service.ShiroUserService>
2020-06-19 11:13:05,548 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=shiroUserService
2020-06-19 11:13:05,548 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(shiroUserService) in AnnotationIocLoader(packages=[com.demo])
2020-06-19 11:13:05,548 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'shiroUserService'<class com.demo.service.ShiroUserService>
2020-06-19 11:13:05,549 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'shiroUserService' to [app]
2020-06-19 11:13:05,549 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.demo.service.ShiroUserService without AOP
2020-06-19 11:13:05,561 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userService'<class com.demo.service.UserService>
2020-06-19 11:13:05,561 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=userService
2020-06-19 11:13:05,562 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userService) in AnnotationIocLoader(packages=[com.demo])
2020-06-19 11:13:05,562 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'userService'<class com.demo.service.UserService>
2020-06-19 11:13:05,562 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'userService' to [app]
2020-06-19 11:13:05,562 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.demo.service.UserService without AOP
2020-06-19 11:13:05,567 [qtp1864548849-17] DEBUG org.nutz.service.EntityService - Get TypeParams for self : com.demo.domain.User
2020-06-19 11:13:05,568 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'userRoleService'<class com.demo.service.UserRoleService>
2020-06-19 11:13:05,568 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=userRoleService
2020-06-19 11:13:05,568 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(userRoleService) in AnnotationIocLoader(packages=[com.demo])
2020-06-19 11:13:05,569 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'userRoleService'<class com.demo.service.UserRoleService>
2020-06-19 11:13:05,569 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'userRoleService' to [app]
2020-06-19 11:13:05,569 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.demo.service.UserRoleService without AOP
2020-06-19 11:13:05,571 [qtp1864548849-17] DEBUG org.nutz.service.EntityService - Get TypeParams for self : com.demo.domain.UserRole
2020-06-19 11:13:05,572 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'config'<>
2020-06-19 11:13:05,572 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dao'<>
2020-06-19 11:13:05,572 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'config'<>
2020-06-19 11:13:05,572 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dao'<>
2020-06-19 11:13:05,572 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'roleService'<class com.demo.service.RoleService>
2020-06-19 11:13:05,572 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'permissionService'<class com.demo.service.PermissionService>
2020-06-19 11:13:05,573 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Load definition name=permissionService
2020-06-19 11:13:05,573 [qtp1864548849-17] DEBUG org.nutz.ioc.loader.combo.ComboIocLoader - Found IocObject(permissionService) in AnnotationIocLoader(packages=[com.demo])
2020-06-19 11:13:05,573 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - >> Make...'permissionService'<class com.demo.service.PermissionService>
2020-06-19 11:13:05,573 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.ScopeContext - Save object 'permissionService' to [app]
2020-06-19 11:13:05,573 [qtp1864548849-17] DEBUG org.nutz.ioc.aop.impl.DefaultMirrorFactory - Load class com.demo.service.PermissionService without AOP
2020-06-19 11:13:05,576 [qtp1864548849-17] DEBUG org.nutz.service.EntityService - Get TypeParams for self : com.demo.domain.Permission
2020-06-19 11:13:05,577 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'config'<>
2020-06-19 11:13:05,577 [qtp1864548849-17] DEBUG org.nutz.ioc.impl.NutIoc - Get 'dao'<>
2020-06-19 11:13:06,730 [qtp1864548849-18] DEBUG org.apache.shiro.web.servlet.SimpleCookie - Found 'sid' cookie value [5eij9fhdmijk8rh88l42pp37u5]
2020-06-19 11:13:06,731 [qtp1864548849-18] DEBUG net.sf.ehcache.store.disk.Segment - put added 0 on heap
2020-06-19 11:13:06,732 [qtp1864548849-18] DEBUG net.sf.ehcache.store.disk.Segment - put updated, deleted 0 on heap
2020-06-19 11:13:06,733 [qtp1864548849-18] DEBUG net.sf.ehcache.store.disk.Segment - put updated, deleted 0 on disk
2020-06-19 11:13:06,747 [shiro-active%0053ession%0043ache.data] DEBUG net.sf.ehcache.store.disk.Segment - fault removed 0 from heap
2020-06-19 11:13:06,747 [shiro-active%0053ession%0043ache.data] DEBUG net.sf.ehcache.store.disk.Segment - fault added 0 on disk
2020-06-19 11:13:06,750 [qtp1864548849-15] DEBUG org.apache.shiro.web.servlet.SimpleCookie - Found 'sid' cookie value [5eij9fhdmijk8rh88l42pp37u5]
2020-06-19 11:13:06,750 [qtp1864548849-15] DEBUG net.sf.ehcache.store.disk.Segment - put added 0 on heap
2020-06-19 11:13:06,751 [qtp1864548849-15] DEBUG net.sf.ehcache.store.disk.Segment - put updated, deleted 0 on heap
2020-06-19 11:13:06,751 [qtp1864548849-15] DEBUG net.sf.ehcache.store.disk.Segment - put updated, deleted 0 on disk
2020-06-19 11:13:06,757 [shiro-active%0053ession%0043ache.data] DEBUG net.sf.ehcache.store.disk.Segment - fault removed 0 from heap
2020-06-19 11:13:06,757 [shiro-active%0053ession%0043ache.data] DEBUG net.sf.ehcache.store.disk.Segment - fault added 0 on disk

2、无注解的方法日志(进入该方法的请求能直接返回结果没有过滤,这是为什么?):
2020-06-19 11:16:17,217 [qtp1864548849-19] DEBUG org.apache.shiro.web.servlet.SimpleCookie - Found 'sid' cookie value [5eij9fhdmijk8rh88l42pp37u5]
2020-06-19 11:16:17,218 [qtp1864548849-19] DEBUG net.sf.ehcache.store.disk.Segment - put added 0 on heap
2020-06-19 11:16:17,219 [qtp1864548849-19] DEBUG net.sf.ehcache.store.disk.Segment - put updated, deleted 0 on heap
2020-06-19 11:16:17,219 [qtp1864548849-19] DEBUG net.sf.ehcache.store.disk.Segment - put updated, deleted 0 on disk
2020-06-19 11:16:17,220 [qtp1864548849-19] DEBUG org.nutz.mvc.impl.UrlMappingImpl - Found mapping for [GET] path=/role/hasnull : RoleModule.hasnull(RoleModule.java:190)
2020-06-19 11:16:17,220 [shiro-active%0053ession%0043ache.data] DEBUG net.sf.ehcache.store.disk.Segment - fault removed 0 from heap
2020-06-19 11:16:17,220 [shiro-active%0053ession%0043ache.data] DEBUG net.sf.ehcache.store.disk.Segment - fault added 0 on disk
2020-06-19 11:16:17,220 [qtp1864548849-19] DEBUG org.nutz.ioc.impl.NutIoc - Get 'roleModule'<class com.demo.module.RoleModule>

2 回复

没注解的就不拦截,没毛病呀

在shiro.ini 中不是配置了
[urls]
/ = anon
/resources/** = anon
/favicon.ico = anon
/logout = logout
只有在登录之后才不会拦截吧?问题是我这个还没有登录啊?shiro我不太熟啊请问到底是什么原理

添加回复
请先登陆
回到顶部