use of org.nutz.integration.shiro.UU32SessionIdGenerator in project nutzboot by nutzam.
the class ShiroEnvStarter method getWebSessionManager.
@IocBean(name = "shiroWebSessionManager")
public WebSessionManager getWebSessionManager() {
DefaultWebSessionManager webSessionManager = conf.make(DefaultWebSessionManager.class, "shiro.session.manager.");
// 带缓存的shiro会话
EnterpriseCacheSessionDAO sessionDAO = new EnterpriseCacheSessionDAO();
sessionDAO.setSessionIdGenerator(new UU32SessionIdGenerator());
webSessionManager.setSessionDAO(sessionDAO);
// cookie
conf.putIfAbsent(PROP_SESSION_COOKIE_NAME, "sid");
conf.putIfAbsent(PROP_SESSION_COOKIE_MAXAGE, "946080000");
conf.putIfAbsent(PROP_SESSION_COOKIE_HTTPONLY, "true");
SimpleCookie cookie = conf.make(SimpleCookie.class, "shiro.session.cookie.");
webSessionManager.setSessionIdCookie(cookie);
webSessionManager.setSessionIdCookieEnabled(true);
webSessionManager.setCacheManager(ioc.get(CacheManager.class, "shiroCacheManager"));
return webSessionManager;
}
Aggregations