本文整理汇总了Java中org.apache.shiro.cache.ehcache.EhCacheManager类的典型用法代码示例。如果您正苦于以下问题:Java EhCacheManager类的具体用法?Java EhCacheManager怎么用?Java EhCacheManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EhCacheManager类属于org.apache.shiro.cache.ehcache包,在下文中一共展示了EhCacheManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEhCacheManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
/**
* 注入缓存
* @return
*/
@Bean
public EhCacheManager getEhCacheManager() {
EhCacheManager em = new EhCacheManager();
em.setCacheManagerConfigFile("classpath:ehcache-shiro.xml");
return em;
}
示例2: myShiroCasRealm
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean(name = "myShiroCasRealm")
public MyShiroCasRealm myShiroCasRealm(EhCacheManager cacheManager) {
MyShiroCasRealm realm = new MyShiroCasRealm();
realm.setCacheManager(cacheManager);
//realm.setCasServerUrlPrefix(ShiroCasConfiguration.casServerUrlPrefix);
// 客户端回调地址
//realm.setCasService(ShiroCasConfiguration.shiroServerUrlPrefix + ShiroCasConfiguration.casFilterUrlPattern);
return realm;
}
示例3: ehCacheManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
/**
* shiro缓存管理器;
* 需要注入对应的其它的实体类中:
* 安全管理器:securityManager
*/
@Bean
public EhCacheManager ehCacheManager(){
System.out.println("ShiroConfiguration.getEhCacheManager()");
EhCacheManager cacheManager = new EhCacheManager();
cacheManager.setCacheManagerConfigFile("classpath:shiro/ehcache-shiro.xml");
return cacheManager;
}
示例4: getDefaultWebSecurityManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean(name = "securityManager")
public DefaultWebSecurityManager getDefaultWebSecurityManager(
SystemAuthorizingRealm myShiroRealm,
DefaultWebSessionManager sessionManager,
EhCacheManager shiroCacheManager) {
DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
dwsm.setRealm(myShiroRealm);
dwsm.setSessionManager(sessionManager);
// <!-- 用户授权/认证信息Cache, 采用EhCache 缓存 -->
dwsm.setCacheManager(shiroCacheManager);
return dwsm;
}
示例5: getSessionDAO
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean(name = "sessionDAO")
public SessionDAO getSessionDAO(IdGen idGen, EhCacheManager shiroCacheManager){
CacheSessionDAO cacheSessionDAO=new CacheSessionDAO();
cacheSessionDAO.setSessionIdGenerator(idGen);
cacheSessionDAO.setActiveSessionsCacheName("activeSessionsCache");
cacheSessionDAO.setCacheManager(shiroCacheManager);
return cacheSessionDAO;
}
示例6: ehcacheManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean(name = "cacheManager")
@ConditionalOnClass(name = {"org.apache.shiro.cache.ehcache.EhCacheManager"})
@ConditionalOnMissingBean(name = "cacheManager")
public CacheManager ehcacheManager() {
EhCacheManager ehCacheManager = new EhCacheManager();
ShiroProperties.Ehcache ehcache = properties.getEhcache();
if (ehcache.getCacheManagerConfigFile() != null) {
ehCacheManager.setCacheManagerConfigFile(ehcache.getCacheManagerConfigFile());
}
return ehCacheManager;
}
示例7: ehcacheManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean(name = "cacheManager")
@ConditionalOnClass(name = {"org.apache.shiro.cache.ehcache.EhCacheManager"})
@ConditionalOnMissingBean(name = "cacheManager")
public CacheManager ehcacheManager() {
EhCacheManager ehCacheManager = new EhCacheManager();
ShiroProperties.Ehcache ehcache = shiroProperties.getEhcache();
if (ehcache.getConfigFile() != null) {
ehCacheManager.setCacheManagerConfigFile(ehcache.getConfigFile());
}
return ehCacheManager;
}
示例8: webSecurityManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean
public DefaultWebSecurityManager webSecurityManager(Realm realm,
CookieRememberMeManager rememberMeManager,
DefaultWebSessionManager sessionManager,
EhCacheManager ehCacheManager) {
DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager();
defaultWebSecurityManager.setRealm(realm);
defaultWebSecurityManager.setRememberMeManager(rememberMeManager);
defaultWebSecurityManager.setSessionManager(sessionManager);
defaultWebSecurityManager.setCacheManager(ehCacheManager);
return defaultWebSecurityManager;
}
示例9: initSecurityManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
private WebSecurityManager initSecurityManager() {
AppDbRealm appDbRealm = new AppDbRealm();
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(appDbRealm);
final EhCacheManager cacheManager = new EhCacheManager();
cacheManager.setCacheManagerConfigFile("classpath:goja/ehcache/shiro-ehcache.xml");
securityManager.setCacheManager(cacheManager);
final DefaultWebSessionManager defaultWebSessionManager = new DefaultWebSessionManager();
defaultWebSessionManager.setSessionIdCookieEnabled(true);
// 默认一年过期时间
final String expiredTimes = shiroConfig.getProperty("session.expired", "10800000");
defaultWebSessionManager.setGlobalSessionTimeout(MoreObjects.firstNonNull(Ints.tryParse(expiredTimes), 10800000));
securityManager.setSessionManager(defaultWebSessionManager);
return securityManager;
}
示例10: initializeCacheManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
private void initializeCacheManager(DefaultSecurityManager dsm) {
if(dsm.getCacheManager() == null) {
EhCacheManager ehCacheManager = new EhCacheManager();
ehCacheManager.setCacheManager(cacheManager);
dsm.setCacheManager(ehCacheManager);
}
}
示例11: PersistenceRealm
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
/**
* Constructor adds EhCacheManager.
*/
public PersistenceRealm() {
super(
new EhCacheManager());
// set hashed credentials matcher
HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher(HASH_ALGORITHM);
credentialsMatcher.setHashIterations(HASH_ITERATIONS);
credentialsMatcher.setStoredCredentialsHexEncoded(false);
setCredentialsMatcher(credentialsMatcher);
}
示例12: securityManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean
public SecurityManager securityManager(net.sf.ehcache.CacheManager cacheManager, SessionManager sessionManager, MyRealm myRealm) {
DefaultWebSecurityManager sm = new DefaultWebSecurityManager();
registLoggingAuthenticationListener(sm);
//
EhCacheManager cm = new EhCacheManager();
cm.setCacheManager(cacheManager);
sm.setCacheManager(cm);
sm.setSessionManager(sessionManager);
// realm.
Preconditions.checkNotNull(myRealm);
sm.setRealm(myRealm);
//
return sm;
}
示例13: getShiroCacheManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean(name = "shiroCacheManager")
public EhCacheManager getShiroCacheManager(EhCacheManagerFactoryBean cacheManager) {
EhCacheManager em = new EhCacheManager();
em.setCacheManager(cacheManager.getObject());
return em;
}
示例14: ehCacheManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean(name = "ehcacheManager")
public EhCacheManager ehCacheManager(){
EhCacheManager em = new EhCacheManager();
em.setCacheManagerConfigFile("classpath:config/ehcache-shiro.xml");
return em;
}
示例15: getCacheManager
import org.apache.shiro.cache.ehcache.EhCacheManager; //导入依赖的package包/类
@Bean
public CacheManager getCacheManager() {
return new EhCacheManager();
}