Example usage for org.apache.shiro.realm AuthorizingRealm getAuthorizationCache

List of usage examples for org.apache.shiro.realm AuthorizingRealm getAuthorizationCache

Introduction

In this page you can find the example usage for org.apache.shiro.realm AuthorizingRealm getAuthorizationCache.

Prototype

public Cache<Object, AuthorizationInfo> getAuthorizationCache() 

Source Link

Usage

From source file:org.pepstock.jem.gwt.server.RolesManagerServiceImpl.java

License:Open Source License

/**
 * This method clears all authorizations cache when a role is changed.<br>
 * That's necessary to invalidate the cache and then to have the updates
 * soon available.//from w  ww  .j  a v  a2  s.  c  om
 */
private void clearAuthorizationCache() {
    RealmSecurityManager mgr = (RealmSecurityManager) SecurityUtils.getSecurityManager();
    Collection<Realm> realmCollection = mgr.getRealms();
    for (Realm realm : realmCollection) {
        if (realm instanceof AuthorizingRealm) {
            AuthorizingRealm authz = (AuthorizingRealm) realm;
            if (authz.isAuthorizationCachingEnabled()) {
                authz.getAuthorizationCache().clear();
            }
        }
    }
}