当前位置: 首页>>代码示例>>Java>>正文


Java SessionDAO类代码示例

本文整理汇总了Java中org.apache.shiro.session.mgt.eis.SessionDAO的典型用法代码示例。如果您正苦于以下问题:Java SessionDAO类的具体用法?Java SessionDAO怎么用?Java SessionDAO使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SessionDAO类属于org.apache.shiro.session.mgt.eis包,在下文中一共展示了SessionDAO类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureShiroWeb

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
@Override
protected void configureShiroWeb() {
  bindRealm().to(EmptyRealm.class); // not used in practice, just here to keep Shiro module happy

  bindSingleton(SessionFactory.class, NexusSessionFactory.class);
  bindSingleton(SessionStorageEvaluator.class, NexusSessionStorageEvaluator.class);
  bindSingleton(SubjectDAO.class, NexusSubjectDAO.class);

  // configure our preferred security components
  bindSingleton(SessionDAO.class, NexusSessionDAO.class);
  bindSingleton(Authenticator.class, FirstSuccessfulModularRealmAuthenticator.class);
  bindSingleton(Authorizer.class, ExceptionCatchingModularRealmAuthorizer.class);
  bindSingleton(FilterChainManager.class, DynamicFilterChainManager.class);

  // path matching resolver has several constructors so we need to point Guice to the appropriate one
  bind(FilterChainResolver.class).toConstructor(ctor(PathMatchingFilterChainResolver.class)).asEagerSingleton();

  // bindings used by external modules
  expose(FilterChainResolver.class);
  expose(FilterChainManager.class);
}
 
开发者ID:sonatype,项目名称:nexus-public,代码行数:22,代码来源:WebSecurityModule.java

示例2: sessionDAO

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
@Bean
@ConditionalOnMissingBean
public SessionDAO sessionDAO(CacheManager cacheManager) {
    EnterpriseCacheSessionDAO dao = new EnterpriseCacheSessionDAO();
    dao.setActiveSessionsCacheName(shiroSessionProperties.getActiveSessionsCacheName());
    Class<? extends SessionIdGenerator> idGenerator = shiroSessionProperties.getIdGenerator();
    if (idGenerator != null) {
        SessionIdGenerator sessionIdGenerator = BeanUtils.instantiate(idGenerator);
        dao.setSessionIdGenerator(sessionIdGenerator);
    }
    dao.setCacheManager(cacheManager);

    return dao;
}
 
开发者ID:storezhang,项目名称:utils,代码行数:15,代码来源:ShiroAutoConfiguration.java

示例3: testBasicOperations

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
@Test
public void testBasicOperations() throws Exception {
    final SessionDAO dao = new FileBasedSessionDAO(rootDir.getRoot().toPath());
    final Session initial = new SimpleSession();

    // A new session ID would be issued.
    final Serializable sessionId = dao.create(initial);
    assertThat(sessionId).isEqualTo(initial.getId());
    assertThat(countSessions(dao)).isOne();

    final Session session = dao.readSession(sessionId);
    assertThat(session).isEqualTo(initial);

    // Change session's last accessed time locally.
    Thread.sleep(10);
    session.touch();
    assertThat(dao.readSession(sessionId).getLastAccessTime())
            .isNotEqualTo(session.getLastAccessTime());

    // Update the session.
    dao.update(session);
    assertThat(dao.readSession(sessionId).getLastAccessTime())
            .isEqualTo(session.getLastAccessTime());

    // Delete the session.
    dao.delete(session);

    // No session exists with the specified session ID.
    assertThatThrownBy(() -> dao.readSession(sessionId))
            .isInstanceOf(UnknownSessionException.class);

    assertThat(countSessions(dao)).isZero();
}
 
开发者ID:line,项目名称:centraldogma,代码行数:34,代码来源:FileBasedSessionDAOTest.java

示例4: countSessions

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
private static int countSessions(SessionDAO dao) {
    int count = 0;
    for (Session ignored : dao.getActiveSessions()) {
        count++;
    }
    return count;
}
 
开发者ID:line,项目名称:centraldogma,代码行数:8,代码来源:FileBasedSessionDAOTest.java

示例5: readSession

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
@Override
public Session readSession(Serializable sessionId) throws UnknownSessionException {
    final SessionDAO sessionDAO = getSessionDAO();
    if(sessionDAO != null) {
        sessionDAO.readSession(sessionId);
    }
    
    return null;
}
 
开发者ID:nano-projects,项目名称:nano-framework,代码行数:10,代码来源:SSOServiceImpl.java

示例6: update

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
@Override
public void update(Session session) throws UnknownSessionException {
    final SessionDAO sessionDAO = getSessionDAO();
    if(sessionDAO != null) {
        sessionDAO.update(session);
    }
}
 
开发者ID:nano-projects,项目名称:nano-framework,代码行数:8,代码来源:SSOServiceImpl.java

示例7: delete

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
@Override
public void delete(Session session) {
    final SessionDAO sessionDAO = getSessionDAO();
    if(sessionDAO != null) {
        sessionDAO.delete(session);
    }
}
 
开发者ID:nano-projects,项目名称:nano-framework,代码行数:8,代码来源:SSOServiceImpl.java

示例8: getSessionDAO

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
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;
}
 
开发者ID:nano-projects,项目名称:nano-framework,代码行数:12,代码来源:SSOServiceImpl.java

示例9: CentralDogmaSessionManager

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
CentralDogmaSessionManager(SessionDAO sessionDao) {
    setSessionDAO(sessionDao);
    setSessionValidationInterval(Duration.ofHours(1).toMillis());
}
 
开发者ID:line,项目名称:centraldogma,代码行数:5,代码来源:CentralDogmaSecurityManager.java

示例10: getSessionDAO

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
public SessionDAO getSessionDAO() {
	return sessionDAO;
}
 
开发者ID:inexistence,项目名称:VideoMeeting,代码行数:4,代码来源:ShiroService.java

示例11: setSessionDAO

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
@Autowired
public void setSessionDAO(SessionDAO sessionDAO) {
	this.sessionDAO = sessionDAO;
}
 
开发者ID:inexistence,项目名称:VideoMeeting,代码行数:5,代码来源:ShiroService.java

示例12: setSessionDAO

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
public void setSessionDAO(SessionDAO sessionDAO) {
    this.sessionDAO = sessionDAO;
    applyCacheManagerToSessionDAO();
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:5,代码来源:DefaultSessionManager.java

示例13: getSessionDAO

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
public SessionDAO getSessionDAO() {
    return this.sessionDAO;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:4,代码来源:DefaultSessionManager.java

示例14: setSessionDAO

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
public void setSessionDAO(SessionDAO sessionDAO) {
	this.sessionDAO = sessionDAO;
	applyCacheManagerToSessionDAO();
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:5,代码来源:SimpleSessionManager.java

示例15: getSessionDAO

import org.apache.shiro.session.mgt.eis.SessionDAO; //导入依赖的package包/类
public SessionDAO getSessionDAO() {
	return this.sessionDAO;
}
 
开发者ID:xuegongzi,项目名称:rabbitframework,代码行数:4,代码来源:SimpleSessionManager.java


注:本文中的org.apache.shiro.session.mgt.eis.SessionDAO类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。