在web项目下, subject.login()成功以后,subject对象保存到哪里了?
如果要在jsp页面下获取Principal,如何获取?是否需要使用shiro标签?
4 回复
在这
package org.apache.shiro.util;
public abstract class ThreadContext {
/**
* Private internal log instance.
*/
private static final Logger log = LoggerFactory.getLogger(ThreadContext.class);
public static final String SECURITY_MANAGER_KEY = ThreadContext.class.getName() + "_SECURITY_MANAGER_KEY";
public static final String SUBJECT_KEY = ThreadContext.class.getName() + "_SUBJECT_KEY";
private static final ThreadLocal<Map<Object, Object>> resources = new InheritableThreadLocalMap<Map<Object, Object>>();
private static Object getValue(Object key) {
Map<Object, Object> perThreadResources = resources.get();
return perThreadResources != null ? perThreadResources.get(key) : null;
}
@Rekoe 查看了下subject的创建,当初创建的时候,也是绑定到了线程上下文中,而不是session回话中。而和Web session 有关系的就是rememberme这属性!
添加回复
请先登陆