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


Java EhCacheManager.setCacheManager方法代码示例

本文整理汇总了Java中org.apache.shiro.cache.ehcache.EhCacheManager.setCacheManager方法的典型用法代码示例。如果您正苦于以下问题:Java EhCacheManager.setCacheManager方法的具体用法?Java EhCacheManager.setCacheManager怎么用?Java EhCacheManager.setCacheManager使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.shiro.cache.ehcache.EhCacheManager的用法示例。


在下文中一共展示了EhCacheManager.setCacheManager方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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);
  }
}
 
开发者ID:obiba,项目名称:agate,代码行数:8,代码来源:SecurityManagerFactory.java

示例2: 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;
}
 
开发者ID:ageldama,项目名称:glados-wiki,代码行数:16,代码来源:ShiroContext.java

示例3: 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;
}
 
开发者ID:egojit8,项目名称:easyweb,代码行数:7,代码来源:ShiroConfiguration.java

示例4: initialize

import org.apache.shiro.cache.ehcache.EhCacheManager; //导入方法依赖的package包/类
@Override
public boolean initialize(SilentGo me) throws AppBuildException {


    ShiroConfig config = (ShiroConfig) me.getConfig().getConfig(Name);

    me.getFactory(CacheFactory.class);
    PropKit prop = me.getConfig().getUserProp();

    RetryLimitHashedCredentialsMatcher retryLimitHashedCredentialsMatcher = new RetryLimitHashedCredentialsMatcher();
    retryLimitHashedCredentialsMatcher.setHashAlgorithmName(prop.getValue(Dict.SHIRO_CREDENTIALS_MATCHER_HASHALGORITHMNAME, "md5"));
    retryLimitHashedCredentialsMatcher.setHashIterations(prop.getInt(Dict.SHIRO_CREDENTIALS_MATCHER_HASHITERATIONS, 2));
    retryLimitHashedCredentialsMatcher.setStoredCredentialsHexEncoded(prop.getBool(Dict.SHIRO_CREDENTIALS_MATCHER_STOREDCREDENTIALSHEXENCODED, true));
    EhCacheManager ehCacheManager = new EhCacheManager();
    EhCache cache = (EhCache) me.getConfig().getCacheManager();
    ehCacheManager.setCacheManager(cache.getCacheManager());

    JavaUuidSessionIdGenerator sessionIdGenerator = new JavaUuidSessionIdGenerator();

    SimpleCookie sessionIdCookie = new SimpleCookie(prop.getValue(Dict.SHIRO_SESSION_COOKIENAME, "lc4e"));
    sessionIdCookie.setMaxAge(prop.getInt(Dict.SHIRO_SESSION_IDCOOKIE_MAXAGE, -1));
    sessionIdCookie.setHttpOnly(prop.getBool(Dict.SHIRO_SESSION_IDCOOKIE_HTTPONLY, true));

    SimpleCookie rememberMeCookie = new SimpleCookie(prop.getValue(Dict.SHIRO_SESSION_REMEMBER_COOKIENAME, "rlc4e"));
    rememberMeCookie.setHttpOnly(prop.getBool(Dict.SHIRO_SESSION_REMEMBER_ME_HTTPONLY, true));
    rememberMeCookie.setMaxAge(prop.getInt(Dict.SHIRO_SESSION_REMEMBER_ME_MAXAGE, 2592000));

    CookieRememberMeManager rememberMeManager = new CookieRememberMeManager();
    rememberMeManager.setCipherKey(Base64.decode(prop.getValue(Dict.SECURITY_KEY, "4AvVhmFLUs0KTA3Kprsdag==")));
    rememberMeManager.setCookie(rememberMeCookie);

    EnterpriseCacheSessionDAO sessionDAO = new EnterpriseCacheSessionDAO();
    sessionDAO.setActiveSessionsCacheName(prop.getValue(Dict.SHIRO_SESSION_ACTIVE_NAME, "shiro-activeSessionCache"));
    sessionDAO.setSessionIdGenerator(sessionIdGenerator);
    sessionDAO.setCacheManager(ehCacheManager);


    config.getRealm().setCredentialsMatcher(retryLimitHashedCredentialsMatcher);
    config.getRealm().setCachingEnabled(false);
    config.getRealm().setCacheManager(ehCacheManager);

    DefaultWebSessionManager sessionManager = new DefaultWebSessionManager();

    sessionValidationScheduler = new QuartzSessionValidationScheduler(sessionManager);
    sessionValidationScheduler.setSessionValidationInterval(prop.getLong(Dict.SHIRO_SESSION_VALIDATIONINTERVAL, 1800000L));

    sessionManager.setGlobalSessionTimeout(prop.getLong(Dict.SHIRO_SESSION_GLOBALSESSIONTIMEOUT, 1800000L));
    sessionManager.setSessionDAO(sessionDAO);
    sessionManager.setSessionValidationInterval(prop.getLong(Dict.SHIRO_SESSION_VALIDATIONINTERVAL, 360000L));
    sessionManager.setSessionValidationScheduler(sessionValidationScheduler);
    sessionManager.setSessionIdCookieEnabled(prop.getBool(Dict.SHIRO_SESSION_IDCOOKIEENABLED, true));
    sessionManager.setSessionIdCookie(sessionIdCookie);


    sessionValidationScheduler.setSessionManager(sessionManager);

    defaultWebSecurityManager = new DefaultWebSecurityManager(config.getRealm());
    defaultWebSecurityManager.setCacheManager(ehCacheManager);
    defaultWebSecurityManager.setRememberMeManager(rememberMeManager);
    defaultWebSecurityManager.setSessionManager(sessionManager);


    ServletContext servletContext = me.getContext();

    ShiroLoader shiroLoader = new ShiroLoader();

    shiroLoader.initEnvironment(servletContext);
    WebEnvironment environment = (WebEnvironment) servletContext.getAttribute(ShiroLoader.ENVIRONMENT_ATTRIBUTE_KEY);
    ((MutableWebEnvironment) environment).setWebSecurityManager(defaultWebSecurityManager);
    servletContext.setAttribute(ShiroLoader.ENVIRONMENT_ATTRIBUTE_KEY, environment);

    return false;
}
 
开发者ID:Teddy-Zhu,项目名称:SilentGo,代码行数:74,代码来源:ShiroFactory.java


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