Tabnine Logo
CachingRealm
Code IndexAdd Tabnine to your IDE (free)

How to use
CachingRealm
in
org.apache.shiro.realm

Best Java code snippets using org.apache.shiro.realm.CachingRealm (Showing top 16 results out of 315)

origin: apache/shiro

/**
 * Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips.
 * <p/>
 * This property is <tt>null</tt> by default, indicating that caching is turned off.
 *
 * @param cacheManager the <tt>CacheManager</tt> to use for data caching, or <tt>null</tt> to disable caching.
 */
public void setCacheManager(CacheManager cacheManager) {
  this.cacheManager = cacheManager;
  afterCacheManagerSet();
}
origin: apache/shiro

/**
 * If caching is enabled, this will clear any cached data associated with the specified account identity.
 * Subclasses are free to override for additional behavior, but be sure to call {@code super.onLogout} first.
 * <p/>
 * This default implementation merely calls {@link #clearCache(org.apache.shiro.subject.PrincipalCollection)}.
 *
 * @param principals the application-specific Subject/user identifier that is logging out.
 * @see #clearCache(org.apache.shiro.subject.PrincipalCollection)
 * @see #getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)
 * @since 1.2
 */
public void onLogout(PrincipalCollection principals) {
  clearCache(principals);
}
origin: apache/shiro

/**
 * Clears out any cached data associated with the specified account identity/identities.
 * <p/>
 * This implementation will return quietly if the principals argument is null or empty.  Otherwise it delegates
 * to {@link #doClearCache(org.apache.shiro.subject.PrincipalCollection)}.
 *
 * @param principals the principals of the account for which to clear any cached data.
 * @since 1.2
 */
protected void clearCache(PrincipalCollection principals) {
  if (!isEmpty(principals)) {
    doClearCache(principals);
    log.trace("Cleared cache entries for account with principals [{}]", principals);
  }
}
origin: apache/shiro

if (!isEmpty(principals)) {
  Collection thisPrincipals = principals.fromRealm(getName());
  if (!CollectionUtils.isEmpty(thisPrincipals)) {
    primary = thisPrincipals.iterator().next();
origin: apache/shiro

public void setName(String name) {
  super.setName(name);
  String authcCacheName = this.authenticationCacheName;
  if (authcCacheName != null && authcCacheName.startsWith(getClass().getName())) {
    //get rid of the default heuristically-created cache name.  Create a more meaningful one
    //based on the application-unique Realm name:
    this.authenticationCacheName = name + DEFAULT_AUTHORIZATION_CACHE_SUFFIX;
  }
}
origin: apache/shiro

/**
 * This implementation clears out any cached authentication data by calling
 * {@link #clearCachedAuthenticationInfo(org.apache.shiro.subject.PrincipalCollection)}.
 * If overriding in a subclass, be sure to call {@code super.doClearCache} to ensure this behavior is maintained.
 *
 * @param principals principals the principals of the account for which to clear any cached data.
 * @since 1.2
 */
@Override
protected void doClearCache(PrincipalCollection principals) {
  super.doClearCache(principals);
  clearCachedAuthenticationInfo(principals);
}
origin: org.neo4j/neo4j-security-enterprise

@Override
public void shutdown() throws Throwable
{
  for ( Realm realm : realms )
  {
    if ( realm instanceof CachingRealm )
    {
      ((CachingRealm) realm).setCacheManager( null );
    }
    if ( realm instanceof RealmLifecycle )
    {
      ((RealmLifecycle) realm).shutdown();
    }
  }
}
origin: com.github.fartherp/shiro-redisson

  public void onExpiration(Session session) {
    LOGGER.debug("session onExpiration ID: " + session.getId());
    this.sessionDAO.delete(session);
    this.cachingRealms.forEach(o -> o.onLogout(SecurityUtils.getSubject().getPrincipals()));
  }
}
origin: org.apache.shiro/shiro-core

if (!isEmpty(principals)) {
  Collection thisPrincipals = principals.fromRealm(getName());
  if (!CollectionUtils.isEmpty(thisPrincipals)) {
    primary = thisPrincipals.iterator().next();
origin: org.apache.shiro/shiro-core

public void setName(String name) {
  super.setName(name);
  String authcCacheName = this.authenticationCacheName;
  if (authcCacheName != null && authcCacheName.startsWith(getClass().getName())) {
    //get rid of the default heuristically-created cache name.  Create a more meaningful one
    //based on the application-unique Realm name:
    this.authenticationCacheName = name + DEFAULT_AUTHORIZATION_CACHE_SUFFIX;
  }
}
origin: org.apache.shiro/shiro-core

/**
 * This implementation clears out any cached authentication data by calling
 * {@link #clearCachedAuthenticationInfo(org.apache.shiro.subject.PrincipalCollection)}.
 * If overriding in a subclass, be sure to call {@code super.doClearCache} to ensure this behavior is maintained.
 *
 * @param principals principals the principals of the account for which to clear any cached data.
 * @since 1.2
 */
@Override
protected void doClearCache(PrincipalCollection principals) {
  super.doClearCache(principals);
  clearCachedAuthenticationInfo(principals);
}
origin: org.neo4j/neo4j-security-enterprise

@Override
public void init() throws Throwable
{
  for ( Realm realm : realms )
  {
    if ( realm instanceof Initializable )
    {
      ((Initializable) realm).init();
    }
    if ( realm instanceof CachingRealm )
    {
      ((CachingRealm) realm).setCacheManager( cacheManager );
    }
    if ( realm instanceof RealmLifecycle )
    {
      ((RealmLifecycle) realm).initialize();
    }
  }
}
origin: org.apache.shiro/shiro-core

/**
 * Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips.
 * <p/>
 * This property is <tt>null</tt> by default, indicating that caching is turned off.
 *
 * @param cacheManager the <tt>CacheManager</tt> to use for data caching, or <tt>null</tt> to disable caching.
 */
public void setCacheManager(CacheManager cacheManager) {
  this.cacheManager = cacheManager;
  afterCacheManagerSet();
}
origin: org.apache.shiro/shiro-core

/**
 * Clears out any cached data associated with the specified account identity/identities.
 * <p/>
 * This implementation will return quietly if the principals argument is null or empty.  Otherwise it delegates
 * to {@link #doClearCache(org.apache.shiro.subject.PrincipalCollection)}.
 *
 * @param principals the principals of the account for which to clear any cached data.
 * @since 1.2
 */
protected void clearCache(PrincipalCollection principals) {
  if (!isEmpty(principals)) {
    doClearCache(principals);
    log.trace("Cleared cache entries for account with principals [{}]", principals);
  }
}
origin: org.apache.shiro/shiro-core

/**
 * If caching is enabled, this will clear any cached data associated with the specified account identity.
 * Subclasses are free to override for additional behavior, but be sure to call {@code super.onLogout} first.
 * <p/>
 * This default implementation merely calls {@link #clearCache(org.apache.shiro.subject.PrincipalCollection)}.
 *
 * @param principals the application-specific Subject/user identifier that is logging out.
 * @see #clearCache(org.apache.shiro.subject.PrincipalCollection)
 * @see #getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection)
 * @since 1.2
 */
public void onLogout(PrincipalCollection principals) {
  clearCache(principals);
}
origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.shiro

/**
 * Sets the <tt>CacheManager</tt> to be used for data caching to reduce EIS round trips.
 * <p/>
 * <p>This property is <tt>null</tt> by default, indicating that caching is turned off.
 *
 * @param cacheManager the <tt>CacheManager</tt> to use for data caching, or <tt>null</tt> to disable caching.
 */
public void setCacheManager(CacheManager cacheManager) {
  this.cacheManager = cacheManager;
  afterCacheManagerSet();
}
org.apache.shiro.realmCachingRealm

Javadoc

A very basic abstract extension point for the Realm interface that provides caching support for subclasses.

It also provides a convenience method, #getAvailablePrincipal(org.apache.shiro.subject.PrincipalCollection), which is useful across all realm subclasses for obtaining a realm-specific principal/identity.

All actual Realm method implementations are left to subclasses.

Most used methods

  • afterCacheManagerSet
    Template method that may be implemented by subclasses should they wish to react to a CacheManager in
  • clearCache
    Clears out any cached data associated with the specified account identity/identities. This implement
  • doClearCache
    This implementation does nothing - it is a template to be overridden by subclasses if necessary.
  • getName
  • isEmpty
  • onLogout
    If caching is enabled, this will clear any cached data associated with the specified account identit
  • setCacheManager
    Sets the CacheManager to be used for data caching to reduce EIS round trips. This property is null
  • setName

Popular in Java

  • Making http requests using okhttp
  • addToBackStack (FragmentTransaction)
  • getExternalFilesDir (Context)
  • getSupportFragmentManager (FragmentActivity)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • SecureRandom (java.security)
    This class generates cryptographically secure pseudo-random numbers. It is best to invoke SecureRand
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Runner (org.openjdk.jmh.runner)
  • Top PhpStorm plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now