源码中没找到。。。。
1 回复
你找 NutShiro.SessionKey 的引用就是的, NutShiro.SessionKey的默认值就是"me"
例如CaptchaFormAuthenticationFilter类
protected boolean onLoginSuccess(AuthenticationToken token, Subject subject, ServletRequest req, ServletResponse resp) throws Exception {
subject.getSession().setAttribute(NutShiro.SessionKey, subject.getPrincipal());
if (NutShiro.isAjax(req)) {
NutShiro.rendAjaxResp(req, resp, new NutMap().setv("ok", true));
return false;
}
return super.onLoginSuccess(token, subject, req, resp);
}
例如OauthModule
// 进行Shiro登录
protected void doShiroLogin(int userId, String _providerId) {
Subject subject = SecurityUtils.getSubject();
subject.login(new OAuthAuthenticationToken(userId));
subject.getSession().setAttribute(NutShiro.SessionKey, userId);
sysLogService.async(SysLog.c("method", "用户登陆", null, userId, "用户通过"+_providerId+" Oauth登陆"));
}
添加回复
请先登陆