本文整理汇总了Java中org.apache.shiro.mgt.DefaultSessionStorageEvaluator类的典型用法代码示例。如果您正苦于以下问题:Java DefaultSessionStorageEvaluator类的具体用法?Java DefaultSessionStorageEvaluator怎么用?Java DefaultSessionStorageEvaluator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DefaultSessionStorageEvaluator类属于org.apache.shiro.mgt包,在下文中一共展示了DefaultSessionStorageEvaluator类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getManager
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; //导入依赖的package包/类
@Bean("securityManager")
public DefaultWebSecurityManager getManager(Realm realm) {
DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
manager.setRealm(realm);
DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
DefaultSessionStorageEvaluator evaluator = new DefaultSessionStorageEvaluator();
evaluator.setSessionStorageEnabled(false);
subjectDAO.setSessionStorageEvaluator(evaluator);
manager.setSubjectDAO(subjectDAO);
return manager;
}
示例2: securityManager
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; //导入依赖的package包/类
@Bean(name = "securityManager")
@ConditionalOnMissingBean
public DefaultSecurityManager securityManager(CacheManager shiroCacheManager) {
DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
// 用自己的Factory实现替换默认
// 用于关闭session功能
dwsm.setSubjectFactory(new StatelessSubjectFactory());
dwsm.setSessionManager(defaultSessionManager());
// 关闭session存储
((DefaultSessionStorageEvaluator) ((DefaultSubjectDAO)dwsm.getSubjectDAO()).getSessionStorageEvaluator()).setSessionStorageEnabled(false);
// <!-- 用户授权/认证信息Cache, 采用EhCache 缓存 -->
dwsm.setCacheManager(shiroCacheManager);
SecurityUtils.setSecurityManager(dwsm);
return dwsm;
}
示例3: StalessSecurityManager
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; //导入依赖的package包/类
public StalessSecurityManager() {
setSubjectFactory(new StalessSubjectFactory()) ;
// Disabling Subject State Session Storage
// https://shiro.apache.org/session-management.html#disabling-subject-state-session-storage
DefaultSubjectDAO subjectDAO = (DefaultSubjectDAO)this.getSubjectDAO() ;
DefaultSessionStorageEvaluator sessionStorageEvaluator = (DefaultSessionStorageEvaluator)subjectDAO.getSessionStorageEvaluator() ;
sessionStorageEvaluator.setSessionStorageEnabled(false) ;
this.setRememberMeManager(null) ;
}
示例4: SessionlessSecurityManager
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; //导入依赖的package包/类
/**
* Constructs a new session-less security manager.
*/
public SessionlessSecurityManager() {
super();
DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
DefaultSessionStorageEvaluator sessionStorageEvaluator = new DefaultSessionStorageEvaluator();
sessionStorageEvaluator.setSessionStorageEnabled(false);
subjectDAO.setSessionStorageEvaluator(sessionStorageEvaluator);
setSubjectDAO(subjectDAO);
}
示例5: init
import org.apache.shiro.mgt.DefaultSessionStorageEvaluator; //导入依赖的package包/类
@Override
public void init() {
if (LOG.isTraceEnabled()) {
LOG.trace("Initializing the '" + getClass().getSimpleName()
+ "' using the default settings.");
}
// use the default realm
final MapDbAuthorizingRealm realm = new MapDbAuthorizingRealm(
handler.getDefaultLocation(true));
if (realm instanceof Initializable) {
realm.init();
}
// create a default manager and set it
final DefaultSecurityManager manager = new DefaultSecurityManager();
manager.setRealm(realm);
// get the manager and initialize it
if (manager instanceof Initializable) {
((Initializable) manager).init();
}
this.manager = manager;
final SessionManager sessionManager = this.manager.getSessionManager();
if (sessionManager instanceof AbstractValidatingSessionManager) {
((AbstractValidatingSessionManager) sessionManager)
.setSessionValidationSchedulerEnabled(false);
}
final SubjectDAO subjectDao = this.manager.getSubjectDAO();
if (subjectDao instanceof DefaultSubjectDAO) {
final SessionStorageEvaluator sessionStorageEvaluator = ((DefaultSubjectDAO) this.manager
.getSubjectDAO()).getSessionStorageEvaluator();
if (sessionStorageEvaluator instanceof DefaultSessionStorageEvaluator) {
((DefaultSessionStorageEvaluator) sessionStorageEvaluator)
.setSessionStorageEnabled(false);
}
}
this.builder = new Subject.Builder(manager);
this.builder.sessionCreationEnabled(false);
}