NutzCN Logo
问答 版主shiro问题 不执行
发布于 2317天前 作者 qq_cba58631 1835 次浏览 复制 上一个帖子 下一个帖子
标签:

版主我集成的shiro 为什么不执行这个方法

	protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
		// null usernames are invalid
		if (principals == null) {
			throw new AuthorizationException("PrincipalCollection method argument cannot be null.");
		}
		int userId = (Integer) principals.getPrimaryPrincipal();
		User user = dao().fetch(User.class, userId);
		if (user == null)
			return null;
		if (user.isLocked())
			throw new LockedAccountException("Account [" + user.getName() + "] is locked.");

		SimpleAuthorizationInfo auth = new SimpleAuthorizationInfo();
		user = dao().fetchLinks(user, null);
		if (user.getRoles() != null) {
			dao().fetchLinks(user.getRoles(), null);
			for (Role role : user.getRoles()) {
				auth.addRole(role.getName());
				if (role.getPermissions() != null) {
					for (Permission p : role.getPermissions()) {
						auth.addStringPermission(p.getName());
					}
				}
			}
		}
		if (user.getPermissions() != null) {
			for (Permission p : user.getPermissions()) {
				auth.addStringPermission(p.getName());
			}
		}
		return auth;
	}
20 回复

realm注册的token类跟使用的token类不一致

一样啊

    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        SimpleShiroToken upToken = (SimpleShiroToken) token;
        User user = dao().fetch(User.class, ((Integer)upToken.getPrincipal()).longValue());
        if (user == null)
            return null;
        if (user.isLocked())
            throw new LockedAccountException("Account [" + user.getName() + "] is locked.");
        return new SimpleAccount(user.getId(), user.getPassword(), getName());
    }
        NutMap re = new NutMap();
        int userId = userService.fetch(username, password);
        if (userId < 0) {
            return re.setv("ok", false).setv("msg", "用户名或密码错误");
        } else {
            session.setAttribute("me", userId);
   
            SecurityUtils.getSubject().login(new SimpleShiroToken(userId));
            //设置登陆失效时长,默认配置为30分钟
            SecurityUtils.getSubject().getSession().setTimeout(1800000);
            return re.setv("ok", true);
        }

整个realm类贴一下

public class SimpleAuthorizingRealm extends AuthorizingRealm {

protected Dao dao;

protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {

    if (principals == null) {
        throw new AuthorizationException("PrincipalCollection method argument cannot be null.");
    }
    int userId = (Integer) principals.getPrimaryPrincipal();
    User user = dao().fetch(User.class, userId);
    if (user == null)
        return null;

    SimpleAuthorizationInfo auth = new SimpleAuthorizationInfo();
    user = dao().fetchLinks(user, null);
    if (user.getRoles() != null) {
        dao().fetchLinks(user.getRoles(), null);
        for (Role role : user.getRoles()) {
            auth.addRole(role.getRolename());
            if (role.getPermissions() != null) {
                for (Permission p : role.getPermissions()) {
                    auth.addStringPermission(p.getPermissionname());
                }
            }
        }
    }
    return auth;
}

protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
    SimpleShiroToken upToken = (SimpleShiroToken) token;
    // upToken.getPrincipal() 的返回值就是SimpleShiroToken构造方法传入的值
    // 可以是int也可以是User类实例,或任何你希望的值,自行处理一下就好了
    User user = dao().fetch(User.class, ((Integer)upToken.getPrincipal()).longValue());
    if (user == null)
        return null;
    if (user.isLocked())
        throw new LockedAccountException("Account [" + user.getName() + "] is locked.");
    return new SimpleAccount(user.getId(), user.getPassword(), getName());
}

/**
 * 覆盖父类的验证,直接pass. 在shiro内做验证的话, 出错了都不知道哪里错
 */
protected void assertCredentialsMatch(AuthenticationToken token, AuthenticationInfo info) throws AuthenticationException {
}

public SimpleAuthorizingRealm() {
    this(null, null);
}

public SimpleAuthorizingRealm(CacheManager cacheManager, CredentialsMatcher matcher) {
    super(cacheManager, matcher);
    setAuthenticationTokenClass(SimpleShiroToken.class);
}

public SimpleAuthorizingRealm(CacheManager cacheManager) {
    this(cacheManager, null);
}

public SimpleAuthorizingRealm(CredentialsMatcher matcher) {
    this(null, matcher);
}

public Dao dao() {
    if (dao == null) {
        dao = Mvcs.ctx().getDefaultIoc().get(Dao.class, "dao");
        return dao;
    }
    return dao;
}

public void setDao(Dao dao) {
    this.dao = dao;
}

}

```

shiro.ini里面声明这个realm没?

[main]
nutzdao_realm = org.visual.reafon.shiro.realm.SimpleAuthorizingRealm

authc = org.nutz.integration.shiro.SimpleAuthenticationFilter
authc.loginUrl = /index.jsp
logout.redirectUrl=/index.jsp
cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager.cacheManagerConfigFile=classpath:ehcache.xml

nutzdao_realm.cacheManager = $cacheManager

[urls]
/rs/* = anon
/user/logout = logout
/user/error = anon
/login = anon
/user/profile/active/mail = anon

[main]
nutzdao_realm = org.visual.reafon.shiro.realm.SimpleAuthorizingRealm

authc = org.nutz.integration.shiro.SimpleAuthenticationFilter
authc.loginUrl  = /index.jsp
logout.redirectUrl=/index.jsp
cacheManager = org.apache.shiro.cache.ehcache.EhCacheManager
cacheManager.cacheManagerConfigFile=classpath:ehcache.xml
#nutzdao_realm.cacheManager = $cacheManager
[urls]
/rs/*        = anon
/user/logout = logout
/user/error  = anon
/login  = anon
/user/profile/active/mail = anon

是不是没进入口方法呢?

哪个是入口方法啊

你贴的这段代码不是从入口方法拷贝出来的?

        NutMap re = new NutMap();
        int userId = userService.fetch(username, password);
        if (userId < 0) {
            return re.setv("ok", false).setv("msg", "用户名或密码错误");
        } else {
            session.setAttribute("me", userId);
   
            SecurityUtils.getSubject().login(new SimpleShiroToken(userId));
            //设置登陆失效时长,默认配置为30分钟
            SecurityUtils.getSubject().getSession().setTimeout(1800000);
            return re.setv("ok", true);
        }

这是我登陆时的方法啊

所以这是入口方法里面的代码啊,难道不是?

标注@At的方法叫 入口方法

是里面的方法

然后就是 "有没有 进这个入口方法呢?"

把日志发一下吧,全部日志

话说,调用login之后发生了什么?报错?没报错?

没报错

2018-07-13 10:35:35,405 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [POST] path=/user/login : UserModule.login(UserModule.java:79)
2018-07-13 10:35:35,411 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'userModule'<class org.visual.reafon.module.UserModule>
2018-07-13 10:35:35,416 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) DEBUG - 	 >> Load definition name=userModule
2018-07-13 10:35:35,416 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(userModule) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,419 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) DEBUG - 	 >> Make...'userModule'<class org.visual.reafon.module.UserModule>
2018-07-13 10:35:35,421 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'userModule' to [app] 
2018-07-13 10:35:35,423 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'txREAD_COMMITTED'<interface org.nutz.aop.MethodInterceptor>
2018-07-13 10:35:35,423 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) DEBUG - 	 >> Load definition name=txREAD_COMMITTED
2018-07-13 10:35:35,423 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=txREAD_COMMITTED
2018-07-13 10:35:35,424 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(txREAD_COMMITTED) in TransIocLoader@729346020
2018-07-13 10:35:35,425 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) DEBUG - 	 >> Make...'txREAD_COMMITTED'<interface org.nutz.aop.MethodInterceptor>
2018-07-13 10:35:35,425 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'txREAD_COMMITTED' to [app] 
2018-07-13 10:35:35,444 org.nutz.aop.asm.AsmClassAgent.<clinit>(AsmClassAgent.java:29) DEBUG - AsmClassAgent will define class in Version 50
2018-07-13 10:35:35,491 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'userService'<class org.visual.reafon.service.UserService>
2018-07-13 10:35:35,491 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) DEBUG - 	 >> Load definition name=userService
2018-07-13 10:35:35,491 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(userService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,491 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) DEBUG - 	 >> Make...'userService'<class org.visual.reafon.service.UserService>
2018-07-13 10:35:35,491 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'userService' to [app] 
2018-07-13 10:35:35,491 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.visual.reafon.service.UserService without AOP
2018-07-13 10:35:35,587 org.nutz.service.EntityService.<init>(EntityService.java:41) DEBUG - Get TypeParams for self : org.visual.reafon.bean.User
2018-07-13 10:35:35,587 org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:64) DEBUG - name=locationService not found, search for type=org.visual.reafon.service.LocationService
2018-07-13 10:35:35,588 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=redisService
2018-07-13 10:35:35,617 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(redisService) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,618 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=jedisCluster
2018-07-13 10:35:35,625 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(jedisCluster) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,625 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=pubSubService
2018-07-13 10:35:35,626 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(pubSubService) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,626 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=daoCollect
2018-07-13 10:35:35,626 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(daoCollect) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,626 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=conf
2018-07-13 10:35:35,626 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,627 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dataSourceCollect
2018-07-13 10:35:35,627 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(dataSourceCollect) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,627 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=sqlManager
2018-07-13 10:35:35,628 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(sqlManager) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,629 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=jedisPool
2018-07-13 10:35:35,630 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(jedisPool) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,630 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=cacheManager
2018-07-13 10:35:35,631 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(cacheManager) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,632 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=redis
2018-07-13 10:35:35,633 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(redis) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,633 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dao
2018-07-13 10:35:35,633 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(dao) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,633 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=cacheProvider
2018-07-13 10:35:35,634 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(cacheProvider) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,634 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=jedisClusterNodes
2018-07-13 10:35:35,636 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(jedisClusterNodes) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,636 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=emailAuthenticator
2018-07-13 10:35:35,637 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(emailAuthenticator) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,638 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=jedisClusterWrapper
2018-07-13 10:35:35,641 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(jedisClusterWrapper) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,642 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=htmlEmail
2018-07-13 10:35:35,646 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(htmlEmail) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,646 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=cacheExecutor
2018-07-13 10:35:35,647 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(cacheExecutor) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,647 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=jedisPoolConfig
2018-07-13 10:35:35,649 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(jedisPoolConfig) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,650 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=jedisAgent
2018-07-13 10:35:35,651 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(jedisAgent) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,651 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dataSource
2018-07-13 10:35:35,651 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2018-07-13 10:35:35,651 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(permissionModule) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,651 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(authorityService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,652 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(LayuiService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,652 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(ResultService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,652 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(authorityModule) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,652 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(userModule) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,652 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(DataManagerService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,652 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(PermissionService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,652 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(dataManagerModule) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,654 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(LocationService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,655 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'LocationService'<interface org.visual.reafon.service.LocationService>
2018-07-13 10:35:35,655 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) DEBUG - 	 >> Load definition name=LocationService
2018-07-13 10:35:35,655 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(LocationService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,655 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) DEBUG - 	 >> Make...'LocationService'<interface org.visual.reafon.service.LocationService>
2018-07-13 10:35:35,655 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'LocationService' to [app] 
2018-07-13 10:35:35,655 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.visual.reafon.service.impl.LocationServiceImpl without AOP
2018-07-13 10:35:35,679 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'dao'<interface org.nutz.dao.Dao>
2018-07-13 10:35:35,679 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'dao'<>
2018-07-13 10:35:35,684 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'dao'<interface org.nutz.dao.Dao>
2018-07-13 10:35:35,685 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'cacheManager'<class net.sf.ehcache.CacheManager>
2018-07-13 10:35:35,686 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'emailService'<interface org.visual.reafon.service.EmailService>
2018-07-13 10:35:35,686 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:183) DEBUG - 	 >> Load definition name=emailService
2018-07-13 10:35:35,686 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:163) DEBUG - Found IocObject(emailService) in AnnotationIocLoader(packages=[org.visual.reafon, org.my.test])
2018-07-13 10:35:35,686 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:215) DEBUG - 	 >> Make...'emailService'<interface org.visual.reafon.service.EmailService>
2018-07-13 10:35:35,686 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'emailService' to [app] 
2018-07-13 10:35:35,686 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class org.visual.reafon.service.impl.EmailServiceImpl without AOP
2018-07-13 10:35:35,704 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM T_VIS_DATA_STATUS  WHERE CLOCK=?) T WHERE ROWNUM <= 1) WHERE RN > 0 
    |                   1 |
    |---------------------|
    | 2018-07-12 00:00:00 |
  For example:> "SELECT * FROM (SELECT T.*, ROWNUM RN FROM ( SELECT * FROM T_VIS_DATA_STATUS  WHERE CLOCK='2018-07-12 00:00:00') T WHERE ROWNUM <= 1) WHERE RN > 0 "
2018-07-13 10:35:35,727 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'dao'<interface org.nutz.dao.Dao>
2018-07-13 10:35:35,728 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT * FROM t_user  WHERE id=?
    | 1 |
    |---|
    | 1 |
  For example:> "SELECT * FROM t_user  WHERE id=1"
2018-07-13 10:35:35,736 org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo(AuthenticatingRealm.java:569) DEBUG - Looked up AuthenticationInfo [1] from doGetAuthenticationInfo
2018-07-13 10:35:35,737 org.apache.shiro.realm.AuthenticatingRealm.cacheAuthenticationInfoIfPossible(AuthenticatingRealm.java:507) DEBUG - AuthenticationInfo caching is disabled for info [1].  Submitted token: [org.nutz.integration.shiro.SimpleShiroToken@6ffeccaa].
2018-07-13 10:35:35,737 org.apache.shiro.authc.AbstractAuthenticator.authenticate(AbstractAuthenticator.java:233) DEBUG - Authentication successful for token [org.nutz.integration.shiro.SimpleShiroToken@6ffeccaa].  Returned account [1]
2018-07-13 10:35:35,737 org.apache.shiro.subject.support.DefaultSubjectContext.resolveSecurityManager(DefaultSubjectContext.java:102) DEBUG - No SecurityManager available in subject context map.  Falling back to SecurityUtils.getSecurityManager() lookup.
2018-07-13 10:35:35,737 org.apache.shiro.mgt.DefaultSecurityManager.resolveSession(DefaultSecurityManager.java:436) DEBUG - Context already contains a session.  Returning.
2018-07-13 10:35:35,737 org.apache.shiro.subject.support.DefaultSubjectContext.resolveSecurityManager(DefaultSubjectContext.java:102) DEBUG - No SecurityManager available in subject context map.  Falling back to SecurityUtils.getSecurityManager() lookup.
2018-07-13 10:35:35,738 org.apache.shiro.web.servlet.SimpleCookie.addCookieHeader(SimpleCookie.java:226) DEBUG - Added HttpServletResponse Cookie [rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Thu, 12-Jul-2018 02:35:35 GMT]
2018-07-13 10:35:35,738 org.apache.shiro.mgt.AbstractRememberMeManager.onSuccessfulLogin(AbstractRememberMeManager.java:290) DEBUG - AuthenticationToken did not indicate RememberMe is requested.  RememberMe functionality will not be executed for corresponding account.
2018-07-13 10:35:35,740 org.visual.reafon.mvc.LogTimeProcessor.process(LogTimeProcessor.java:24) DEBUG - [POST]URI=/user/login 331ms
2018-07-13 10:35:36,776 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [GET] path=/user/menu : UserModule.menu(UserModule.java:48)
2018-07-13 10:35:36,776 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:157) DEBUG - Get 'userModule'<class org.visual.reafon.module.UserModule>
2018-07-13 10:35:38,268 org.visual.reafon.mvc.LogTimeProcessor.process(LogTimeProcessor.java:24) DEBUG - [ GET]URI=/user/menu 1492ms

doGetAuthorizationInfo 是判断role/permission的时候才会调用
doGetAuthenticationInfo 是登录的时候调用

单词很像, 容易混淆

我登陆的时候 应该会判断 这个用户有什么角色和权限吧 应该是登陆的时候先到doGetAuthorizationInfo 这里面把这个用户相关的角色和权限都放进去吧

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