/** * Simply calls {@link #applyCacheManagerToRealms() applyCacheManagerToRealms()} to allow the * newly set {@link org.apache.shiro.cache.CacheManager CacheManager} to be propagated to the internal collection of <code>Realm</code> * that would need to use it. */ protected void afterCacheManagerSet() { super.afterCacheManagerSet(); applyCacheManagerToRealms(); }
/** * Sets any configured EventBus on the SessionManager if necessary. * * @since 1.3 */ @Override protected void afterEventBusSet() { super.afterEventBusSet(); applyEventBusToSessionManager(); }
@Override protected void afterEventBusSet() { super.afterEventBusSet(); applyEventBusToRealms(); }
/** * Default no-arg constructor. */ public DefaultSecurityManager() { super(); this.subjectFactory = new DefaultSubjectFactory(); this.subjectDAO = new DefaultSubjectDAO(); }
/** * @param sessionManager * @since 1.2 */ private void setInternalSessionManager(SessionManager sessionManager) { super.setSessionManager(sessionManager); }
/** * Determines if the subject's session will be used to persist subject state or not. This implementation * merely delegates to the internal {@link SessionStorageEvaluator} (a * {@code DefaultSessionStorageEvaluator} by default). * * @param subject the subject to inspect to determine if the subject's session will be used to persist subject * state or not. * @return {@code true} if the subject's session will be used to persist subject state, {@code false} otherwise. * @see #setSessionStorageEvaluator(SessionStorageEvaluator) * @see DefaultSessionStorageEvaluator */ protected boolean isSessionStorageEnabled(Subject subject) { return getSessionStorageEvaluator().isSessionStorageEnabled(subject); }
/** * Supporting constructor for a single-realm application. * * @param singleRealm the single realm used by this SecurityManager. */ public DefaultSecurityManager(Realm singleRealm) { this(); setRealm(singleRealm); }
protected Session resolveContextSession(SubjectContext context) throws InvalidSessionException { SessionKey key = getSessionKey(context); if (key != null) { return getSession(key); } return null; }
public void destroy() { LifecycleUtils.destroy(getAuthenticator()); this.authenticator = null; super.destroy(); } }
public void destroy() { LifecycleUtils.destroy(getSessionManager()); this.sessionManager = null; super.destroy(); } }
/** * Calls {@link org.apache.shiro.mgt.AuthorizingSecurityManager#afterCacheManagerSet() super.afterCacheManagerSet()} and then immediately calls * {@link #applyCacheManagerToSessionManager() applyCacheManagerToSessionManager()} to ensure the * <code>CacheManager</code> is applied to the SessionManager as necessary. */ @Override protected void afterCacheManagerSet() { super.afterCacheManagerSet(); applyCacheManagerToSessionManager(); }
public void destroy() { LifecycleUtils.destroy(getAuthorizer()); this.authorizer = null; super.destroy(); }
/** * Passes on the {@link #getRealms() realms} to the internal delegate <code>Authenticator</code> instance so * that it may use them during authentication attempts. */ protected void afterRealmsSet() { super.afterRealmsSet(); if (this.authenticator instanceof ModularRealmAuthenticator) { ((ModularRealmAuthenticator) this.authenticator).setRealms(getRealms()); } }
/** * Supporting constructor for multiple {@link #setRealms realms}. * * @param realms the realm instances backing this SecurityManager. */ public DefaultSecurityManager(Collection<Realm> realms) { this(); setRealms(realms); }
/** * Reacts to a failed login by immediately {@link #forgetIdentity(org.apache.shiro.subject.Subject) forgetting} any * previously remembered identity. This is an additional security feature to prevent any remenant identity data * from being retained in case the authentication attempt is not being executed by the expected user. * * @param subject the subject which executed the failed login attempt * @param token the authentication token resulting in a failed login attempt - ignored by this implementation * @param ae the exception thrown as a result of the failed login attempt - ignored by this implementation */ public void onFailedLogin(Subject subject, AuthenticationToken token, AuthenticationException ae) { forgetIdentity(subject); }
/** * Template callback to notify subclasses that a * {@link org.apache.shiro.cache.CacheManager CacheManager} has been set and is available for use via the * {@link #getCacheManager getCacheManager()} method. */ protected void afterCacheManagerSet() { applyEventBusToCacheManager(); }
/** * Removes any existing subject state from the subject's session (if the session exists). * * @param subject the Subject instance for which any persistent state should be deleted. */ public void delete(Subject subject) { removeFromSession(subject); } }
/** * Reacts to a subject logging out of the application and immediately * {@link #forgetIdentity(org.apache.shiro.subject.Subject) forgets} any previously stored identity and returns. * * @param subject the subject logging out. */ public void onLogout(Subject subject) { forgetIdentity(subject); } }
/** * Template callback to notify subclasses that an {@link EventBus EventBus} has been set and is available for use * via the {@link #getEventBus() getEventBus()} method. * * @since 1.3 */ protected void afterEventBusSet() { applyEventBusToCacheManager(); }