Example usage for org.apache.shiro.cache CacheManager getCache

List of usage examples for org.apache.shiro.cache CacheManager getCache

Introduction

In this page you can find the example usage for org.apache.shiro.cache CacheManager getCache.

Prototype

public <K, V> Cache<K, V> getCache(String name) throws CacheException;

Source Link

Document

Acquires the cache with the specified name.

Usage

From source file:cn.mypandora.shiro.credentials.RetryLimitHashedCredentialsMatcher.java

License:Apache License

public RetryLimitHashedCredentialsMatcher(CacheManager cacheManager) {
    passwordRetryCache = cacheManager.getCache("passwordRetryCache");
}

From source file:cn.powerdash.libsystem.common.security.SecurityContext.java

License:Open Source License

/**
 * Description: ??//w  w w .  j  a  v a2s . co m
 * 
 * @param users
 */
public static void clearAllAuthzCache() {
    CacheManager cm = (CacheManager) ((CachingSecurityManager) SecurityUtils.getSecurityManager())
            .getCacheManager();
    cm.getCache(AppConfigUtil.getConfig(CACHE_NAME_AUTHZ)).clear();
}

From source file:cn.powerdash.libsystem.common.security.SecurityContext.java

License:Open Source License

/**
 * Description: ??//from   ww  w. java  2s .  c  o m
 * 
 * @param users
 */
public static void clearAllAuthcCache() {
    CacheManager cm = (CacheManager) ((CachingSecurityManager) SecurityUtils.getSecurityManager())
            .getCacheManager();
    cm.getCache(AppConfigUtil.getConfig(CACHE_NAME_AUTHC)).clear();
}

From source file:com.wms.studio.filter.KickoutSessionControlFilter.java

License:Apache License

public void setCacheManager(CacheManager cacheManager) {
    this.cache = cacheManager.getCache("shiro-kickout-session");
}

From source file:de.iai.ilcd.security.IlcdSecurityRealm.java

License:Open Source License

/**
 * {@inheritDoc} <br />/*from   w w w. j a v  a  2  s .  c  o m*/
 * Original code from {@link AuthorizingRealm}, copied and modified due to
 * dependency of {@link #getAvailableAuthorizationCache()}
 */
private Cache<Object, AuthorizationInfo> getAuthorizationCacheLazy() {
    Cache<Object, AuthorizationInfo> authorizationCache = this.getAuthorizationCache();
    if (authorizationCache == null) {

        if (log.isDebugEnabled()) {
            log.debug("No authorizationCache instance set.  Checking for a cacheManager...");
        }

        CacheManager cacheManager = this.getCacheManager();

        if (cacheManager != null) {
            String cacheName = this.getAuthorizationCacheName();
            if (log.isDebugEnabled()) {
                log.debug("CacheManager [" + cacheManager + "] has been configured.  Building "
                        + "authorization cache named [" + cacheName + "]");
            }
            authorizationCache = cacheManager.getCache(cacheName);
        } else {
            if (log.isInfoEnabled()) {
                log.info("No cache or cacheManager properties have been set.  Authorization cache cannot "
                        + "be obtained.");
            }
        }
    }

    return authorizationCache;
}

From source file:org.obiba.opal.core.runtime.security.SpatialRealm.java

License:Open Source License

@Override
protected void afterCacheManagerSet() {
    super.afterCacheManagerSet();
    if (isAuthorizationCachingEnabled()) {
        CacheManager cacheManager = getCacheManager();
        rolePermissionCache = cacheManager.getCache(getAuthorizationCacheName() + "_role");
    }/*from   w w  w. j  av  a 2s .co m*/
}

From source file:org.sonatype.security.realms.url.URLRealm.java

License:Open Source License

private Cache<Object, Object> getAuthenticationCache() {

    if (this.authenticatingCache == null) {
        this.logger.debug("No cache implementation set.  Checking cacheManager...");

        CacheManager cacheManager = getCacheManager();

        if (cacheManager != null) {
            String cacheName = this.getAuthenticationCacheName();
            if (cacheName == null) {
                // Simple default in case they didn't provide one:
                cacheName = getClass().getName() + "-" + INSTANCE_COUNT++
                        + DEFAULT_AUTHENTICATION_CACHE_POSTFIX;
                setAuthorizationCacheName(cacheName);
            }/*from   www .j  a  va2  s .c om*/
            this.logger.debug("CacheManager [" + cacheManager + "] has been configured.  Building "
                    + "authentication cache named [" + cacheName + "]");
            this.authenticatingCache = cacheManager.getCache(cacheName);
        } else {

            this.logger.info("No cache or cacheManager properties have been set.  Authorization caching is "
                    + "disabled.");
        }
    }
    return this.authenticatingCache;
}

From source file:top.sj.shiro.RetryLimitCredentialsMatcher.java

License:Open Source License

public void RetryLimitHashedCredentialsMatcher(CacheManager cacheManager) {
    passwordRetryCache = cacheManager.getCache("passwordRetryCache");
}