Example usage for org.apache.shiro.cache.ehcache EhCacheManager EhCacheManager

List of usage examples for org.apache.shiro.cache.ehcache EhCacheManager EhCacheManager

Introduction

In this page you can find the example usage for org.apache.shiro.cache.ehcache EhCacheManager EhCacheManager.

Prototype

public EhCacheManager() 

Source Link

Document

Default no argument constructor

Usage

From source file:com.ikanow.aleph2.security.service.CoreEhCacheManager.java

License:Apache License

public EhCacheManager getCacheManager() {
    if (ehCacheManagerInstance == null) {
        System.setProperty("ehcache.disk.store.dir",
                System.getProperty("java.io.tmpdir") + "/shiro-cache-" + System.getProperty("user.name"));
        ehCacheManagerInstance = new EhCacheManager();
        ehCacheManagerInstance.setCacheManagerConfigFile("classpath:ehcache.xml");
    }/*from w w w. j  av  a  2s .  c  o m*/
    logger.debug("CoreEhCacheManager.getCacheManager:" + ehCacheManagerInstance);
    return ehCacheManagerInstance;
}

From source file:com.smile.core.shiro.configuration.ShiroConfiguration.java

License:Apache License

@Bean
protected CacheManager cacheManager() {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManagerConfigFile("classpath:ehcache.xml");
    return ehCacheManager;
}

From source file:com.whatlookingfor.core.config.ShiroConfiguration.java

License:Apache License

/**
 * ??//from  ww w.  j a  va  2s  . co  m
 * @return EhCacheManager
 */
@Bean(name = "shiroCacheManager")
public EhCacheManager shiroCacheManager() {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManager(cacheManager().getObject());
    return ehCacheManager;
}

From source file:com.whatlookingfor.sample.config.ShiroConfiguration.java

License:Apache License

@Bean(name = "cacheManager")
public EhCacheManager cacheManager() {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManagerConfigFile("classpath:cache/ehcache-local.xml");
    return ehCacheManager;
}

From source file:net.kr9ly.thinfw.dagger.module.AppSecurityManagerModule.java

License:Apache License

@ApplicationScope
@Provides// w ww .  ja v  a  2 s. c  o m
SessionManager sessionManager() {
    DefaultSessionManager sessionManager = new DefaultSessionManager();
    EnterpriseCacheSessionDAO sessionDAO = new EnterpriseCacheSessionDAO();
    sessionDAO.setSessionIdGenerator(new JavaUuidSessionIdGenerator());
    sessionManager.setSessionDAO(new EnterpriseCacheSessionDAO());
    sessionManager.setCacheManager(new EhCacheManager());
    return sessionManager;
}

From source file:org.killbill.billing.util.glue.EhCacheManagerProvider.java

License:Apache License

@Override
public EhCacheManager get() {
    final EhCacheManager shiroEhCacheManager = new EhCacheManager();
    // Same EhCache manager instance as the rest of the system
    shiroEhCacheManager.setCacheManager(ehCacheCacheManager);

    if (securityManager instanceof DefaultSecurityManager) {
        // For RBAC only (see also KillbillJdbcTenantRealmProvider)
        ((DefaultSecurityManager) securityManager).setCacheManager(shiroEhCacheManager);
    }//from w  ww  .ja  v a 2s  .  c  o m

    return shiroEhCacheManager;
}

From source file:org.obiba.mica.security.SecurityManagerFactory.java

License:Open Source License

private void initializeCacheManager(DefaultWebSecurityManager dsm) {
    if (dsm.getCacheManager() == null) {
        EhCacheManager ehCacheManager = new EhCacheManager();
        ehCacheManager.setCacheManager(cacheManager);
        dsm.setCacheManager(ehCacheManager);
    }/*from   www  .  j  a  va 2 s.co m*/
}

From source file:org.owasp.dependencytrack.config.SecurityConfiguration.java

License:Open Source License

public EhCacheManager cacheManager() {
    EhCacheManager ehCacheManager = new EhCacheManager();
    ehCacheManager.setCacheManager(new EhCacheManagerFactoryBean().getObject());
    return ehCacheManager;
}

From source file:org.panifex.security.persistence.PersistenceRealm.java

License:Open Source License

/**
 * Constructor adds EhCacheManager.//from ww  w.  j  a v  a 2 s .  c  o  m
 */
public PersistenceRealm() {
    super(new EhCacheManager());

    // set hashed credentials matcher
    HashedCredentialsMatcher credentialsMatcher = new HashedCredentialsMatcher(HASH_ALGORITHM);
    credentialsMatcher.setHashIterations(HASH_ITERATIONS);
    credentialsMatcher.setStoredCredentialsHexEncoded(false);
    setCredentialsMatcher(credentialsMatcher);
}

From source file:org.sonatype.nexus.security.internal.DefaultSecuritySystem.java

License:Open Source License

@Override
public synchronized void start() throws Exception {
    checkState(!started, "Already started");

    log.info("Starting");

    // FIXME: Sort out overlap in responsibility between lifecycle here and RealmManagerImpl
    // FIXME: Wonder if a provider to handle configuration of RealmSecurityManager here is better?

    // prepare security manager
    if (realmSecurityManager instanceof Initializable) {
        ((Initializable) realmSecurityManager).init();
    }//from ww  w  .  j a v a2s.c  om

    // prepare shiro cache
    EhCacheManager shiroCacheManager = new EhCacheManager();
    shiroCacheManager.setCacheManager(cacheManager);
    realmSecurityManager.setCacheManager(shiroCacheManager);

    // TODO: Sort out better means to invoke lifecycle here, realm-manager is only here for start/stop now
    realmManager.start();

    started = true;
}