org.apache.shiro.session.mgt.SessionManager Java Examples

The following examples show how to use org.apache.shiro.session.mgt.SessionManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShiroConfig.java    From erp-framework with MIT License 5 votes vote down vote up
/**
 * 配置会话管理器,设定会话超时及保存
 * @return
 */
@Bean
public SessionManager sessionManager() {
    DefaultWebSessionManager manager = new DefaultWebSessionManager();
    //设置session过期时间为1小时(单位:毫秒),默认为30分钟
    manager.setGlobalSessionTimeout(60 * 60 * 1000);
    // 是否开启定时调度器进行检测过期session
    manager.setSessionValidationSchedulerEnabled(true);
    manager.setSessionDAO(sessionDao());
    return manager;
}
 
Example #2
Source File: RestSecurityManager.java    From usergrid with Apache License 2.0 5 votes vote down vote up
@Override
public void setSessionManager( SessionManager sessionManager ) {
    if ( !( sessionManager instanceof HttpRequestSessionManager ) ) {
        logger.info( "Replacing {} with HttpRequestSessionManager", sessionManager );
        sessionManager = new HttpRequestSessionManager();
    }
    super.setSessionManager( sessionManager );
}
 
Example #3
Source File: SSOServiceImpl.java    From nano-framework with Apache License 2.0 5 votes vote down vote up
protected SessionDAO getSessionDAO() {
    final SecurityManager securityManager = SecurityUtils.getSecurityManager();
    if(securityManager instanceof SessionsSecurityManager) {
        final SessionManager sessionManager = ((SessionsSecurityManager) securityManager).getSessionManager();
        if(sessionManager instanceof DefaultSessionManager) {
            return ((DefaultSessionManager) sessionManager).getSessionDAO();
        }
    }
    
    return null;
}
 
Example #4
Source File: WebSecurityModule.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected void bindSessionManager(final AnnotatedBindingBuilder<SessionManager> bind) {
  // use native web session management instead of delegating to servlet container
  // workaround for NEXUS-5727, see NexusDefaultWebSessionManager javadoc for clues
  bind.to(NexusWebSessionManager.class).asEagerSingleton();
  // this is a PrivateModule, so explicitly binding the NexusDefaultSessionManager class
  bind(NexusWebSessionManager.class);
}
 
Example #5
Source File: ShiroConfiguration.java    From utils with Apache License 2.0 5 votes vote down vote up
@Bean(name = "securityManager")
@DependsOn(value = {"cacheManager", "rememberMeManager", "mainRealm"})
public DefaultSecurityManager securityManager(Realm realm, RememberMeManager rememberMeManager, CacheManager cacheManager, SessionManager sessionManager) {
    DefaultSecurityManager sm = new DefaultWebSecurityManager();
    sm.setRealm(realm);
    sm.setCacheManager(cacheManager);
    sm.setSessionManager(sessionManager);
    sm.setRememberMeManager(rememberMeManager);

    return sm;
}
 
Example #6
Source File: ShiroConfig.java    From server-boilerplate with MIT License 5 votes vote down vote up
@Bean
public SessionManager getSessionManager() {
    DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();
    sessionManager.setGlobalSessionTimeout(180000);
    sessionManager.setDeleteInvalidSessions(true);
    return sessionManager;
}
 
Example #7
Source File: ShiroConfiguration.java    From spring-boot-shiro with Apache License 2.0 5 votes vote down vote up
@Bean(name = "securityManager")
@DependsOn(value = {"cacheManager", "rememberMeManager", "mainRealm"})
public DefaultSecurityManager securityManager(Realm realm, RememberMeManager rememberMeManager,
                                              CacheManager cacheManager, SessionManager sessionManager) {
    DefaultSecurityManager sm = new DefaultWebSecurityManager();
    sm.setRealm(realm);
    sm.setCacheManager(cacheManager);
    sm.setSessionManager(sessionManager);
    sm.setRememberMeManager(rememberMeManager);
    return sm;
}
 
Example #8
Source File: KeepOneUserFilter.java    From jsets-shiro-spring-boot-starter with Apache License 2.0 5 votes vote down vote up
public KeepOneUserFilter(ShiroProperties properties,CacheDelegator cacheDelegator
				,SessionManager sessionManager,AuthListenerManager authListenerManager) {
	this.properties = properties;
	this.cacheDelegator = cacheDelegator;
	this.sessionManager = sessionManager;
	this.authListenerManager = authListenerManager;
}
 
Example #9
Source File: ShiroConfig.java    From mysiteforme with Apache License 2.0 5 votes vote down vote up
@Bean
public SessionManager webSessionManager(){
    DefaultWebSessionManager manager = new DefaultWebSessionManager();
    //设置session过期时间为1小时(单位:毫秒),默认为30分钟
    manager.setGlobalSessionTimeout(60 * 60 * 1000);
    manager.setSessionValidationSchedulerEnabled(true);
    manager.setSessionDAO(redisSessionDAO());
    return manager;
}
 
Example #10
Source File: ShiroConfiguration.java    From spring-boot-seed with MIT License 5 votes vote down vote up
/**
 * SessionManager,设置Session超时
 *
 * @return SessionManager
 */
@Bean
public SessionManager sessionManager() {
    DefaultWebSessionManager defaultWebSessionManager = new DefaultWebSessionManager();
    defaultWebSessionManager.setGlobalSessionTimeout(7200000);
    defaultWebSessionManager.setDeleteInvalidSessions(true);
    return defaultWebSessionManager;
}
 
Example #11
Source File: SecurityModule.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
protected void bindSessionManager(AnnotatedBindingBuilder<SessionManager> bind) {
bind.to(DefaultSessionManager.class).asEagerSingleton();
bind(DefaultSessionManager.class);
   bindConstant().annotatedWith(Names.named("shiro.globalSessionTimeout")).to(globalSessionTimeoutInSecs * 1000L);
   bindConstant().annotatedWith(Names.named("shiro.sessionValidationSchedulerEnabled")).to(false);
}
 
Example #12
Source File: ClientBridgeSecurityModule.java    From arcusplatform with Apache License 2.0 5 votes vote down vote up
@Override
protected void bindSessionManager(AnnotatedBindingBuilder<SessionManager> bind) {     
  shiroSessionListeners = Multibinder.newSetBinder(binder(), SessionListener.class, Names.named(GuicySessionManager.PROP_SESSION_LISTENERS));
  shiroSessionListeners.addBinding().to(ShiroSessionRegistryExpirer.class).asEagerSingleton();

  bind.to(GuicySessionManager.class).asEagerSingleton();
  bind(GuicySessionManager.class);
  bindRealm().to(AppHandoffRealm.class);
}
 
Example #13
Source File: ShiroConfig.java    From litemall with MIT License 4 votes vote down vote up
@Bean
public SessionManager sessionManager() {

    return new AdminWebSessionManager();
}
 
Example #14
Source File: KickoutSessionFilter.java    From RuoYi with Apache License 2.0 4 votes vote down vote up
public void setSessionManager(SessionManager sessionManager) {
    this.sessionManager = sessionManager;
}
 
Example #15
Source File: SysAccessControllerFilter.java    From taoshop with Apache License 2.0 4 votes vote down vote up
public void setSessionManager(SessionManager sessionManager){
    this.sessionManager = sessionManager;
}
 
Example #16
Source File: ShiroConfig.java    From mall with MIT License 4 votes vote down vote up
@Bean
public SessionManager sessionManager() {
    AdminWebSessionManager mySessionManager = new AdminWebSessionManager();
    return mySessionManager;
}
 
Example #17
Source File: kickoutSessionControlFilter.java    From songjhh_blog with Apache License 2.0 4 votes vote down vote up
public void setSessionManager(SessionManager sessionManager) {
    this.sessionManager = sessionManager;
}
 
Example #18
Source File: PersonDAOSecurityModule.java    From arcusplatform with Apache License 2.0 4 votes vote down vote up
@Override
public void configure() {
   super.configure();
   expose(SessionManager.class);
}
 
Example #19
Source File: ShiroConfig.java    From dts-shop with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Bean
public SessionManager sessionManager() {
	AdminWebSessionManager mySessionManager = new AdminWebSessionManager();
	return mySessionManager;
}
 
Example #20
Source File: KickoutSessionControlFilter.java    From MultimediaDesktop with Apache License 2.0 4 votes vote down vote up
public void setSessionManager(SessionManager sessionManager) {
	this.sessionManager = sessionManager;
}
 
Example #21
Source File: KickoutSessionFilter.java    From supplierShop with MIT License 4 votes vote down vote up
public void setSessionManager(SessionManager sessionManager)
{
    this.sessionManager = sessionManager;
}
 
Example #22
Source File: ShiroConfig.java    From spring-boot-shiro with Apache License 2.0 3 votes vote down vote up
/**
 * 自定义sessionManager
 * create by: leigq
 * create time: 2019/7/3 14:31
 *
 * @return SessionManager
 */
@Bean
public SessionManager sessionManager() {
    MySessionManager mySessionManager = new MySessionManager();
    mySessionManager.setSessionDAO(redisSessionDAO());
    return mySessionManager;
}