Example usage for org.apache.shiro.cache Cache clear

List of usage examples for org.apache.shiro.cache Cache clear

Introduction

In this page you can find the example usage for org.apache.shiro.cache Cache clear.

Prototype

public void clear() throws CacheException;

Source Link

Document

Clear all entries from the cache.

Usage

From source file:com.asia.bomc.workflow.security.SecurityRealm.java

License:Apache License

/**
 * ??/*from  w w w.  j  a va  2 s.  c  om*/
 */
public void clearAllCachedAuthorizationInfo() {
    Cache<Object, AuthorizationInfo> cache = getAuthorizationCache();
    if (cache != null) {
        cache.clear();
    }
}

From source file:com.epimorphics.registry.security.BaseRegRealm.java

License:Apache License

/**
 * Clear cached authentication and authorization information
 * for an individual. Should be called from UserStore implementation
 * whenever a change is made.//ww  w. j  av  a 2s .  c  om
 */
protected void clearCacheFor(String id) {
    UserInfo principal = new UserInfo(id, null);
    PrincipalCollection pc = new SimplePrincipalCollection(principal, getName());
    clearCache(pc);
    if (id.equals(UserStore.AUTH_USER_ID)) {
        // For the anonymous user have to lose whole cache because this affects every user
        Cache<Object, AuthorizationInfo> cache = getAuthorizationCache();
        if (cache != null) {
            cache.clear();
        }
    }
}

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

License:Apache License

@Override
public void clearAllCaches() {
    logger.debug("clearAllCaches");

    Cache<Object, AuthenticationInfo> ac = getAuthenticationCache();
    if (ac != null) {
        ac.clear();
    }/*from  ww w .  j  av a 2  s .c o m*/
    Cache<Object, AuthorizationInfo> ar = getAuthorizationCache();
    if (ar != null) {
        ar.clear();
    }

}

From source file:com.ikanow.aleph2.security.shiro.ActiveSessionRealm.java

License:Apache License

@Override
public void clearAllCaches() {
    logger.debug("clearAllCaches");

    Cache<Object, AuthenticationInfo> ac = getAuthenticationCache();
    if (ac != null) {
        ac.clear();
    }/*from w w  w.j a  v a 2s . c o m*/
    Cache<Object, AuthorizationInfo> ar = getAuthorizationCache();
    if (ar != null) {
        ar.clear();
    }
}

From source file:org.sonatype.nexus.ldap.LdapRealm.java

License:Open Source License

/**
 * Clears Shiro cache if passed instance is not {@code null}.
 *
 * @since 2.8// www  . j a  v  a 2  s.  c o  m
 */
protected void clearIfNonNull(@Nullable final Cache cache) {
    if (cache != null) {
        cache.clear();
    }
}

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

License:Open Source License

/**
 * Looks up registered {@link AuthenticatingRealm}s, and clears their authc caches if they have it set.
 *///from w  w  w .  java 2s .c  o  m
private void clearAuthcRealmCaches() {
    // NOTE: we don't need to iterate all the Sec Managers, they use the same Realms, so one is fine.
    Collection<Realm> realms = realmSecurityManager.getRealms();
    if (realms != null) {
        for (Realm realm : realms) {
            if (realm instanceof AuthenticatingRealm) {
                Cache cache = ((AuthenticatingRealm) realm).getAuthenticationCache();
                if (cache != null) {
                    log.debug("Clearing cache: {}", cache);
                    cache.clear();
                }
            }
        }
    }
}

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

License:Open Source License

/**
 * Looks up registered {@link AuthorizingRealm}s, and clears their authz caches if they have it set.
 *//*from  www.  j  a  v  a2  s.  com*/
private void clearAuthzRealmCaches() {
    // NOTE: we don't need to iterate all the Sec Managers, they use the same Realms, so one is fine.
    Collection<Realm> realms = realmSecurityManager.getRealms();
    if (realms != null) {
        for (Realm realm : realms) {
            if (realm instanceof AuthorizingRealm) {
                Cache cache = ((AuthorizingRealm) realm).getAuthorizationCache();
                if (cache != null) {
                    log.debug("Clearing cache: {}", cache);
                    cache.clear();
                }
            }
        }
    }
}

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

License:Open Source License

/**
 * Clears Shiro cache if passed instance is not {@code null}.
 *
 * @since 2.8/*  w  w  w  . j a v a  2  s  . c o m*/
 */
private void clearIfNonNull(@Nullable final Cache cache) {
    if (cache != null) {
        cache.clear();
    }
}