public void destroy() { LifecycleUtils.destroy(getSessionManager()); this.sessionManager = null; super.destroy(); } }
/** * Sets the underlying delegate {@link SessionManager} instance that will be used to support this implementation's * <tt>SessionManager</tt> method calls. * <p/> * This <tt>SecurityManager</tt> implementation does not provide logic to support the inherited * <tt>SessionManager</tt> interface, but instead delegates these calls to an internal * <tt>SessionManager</tt> instance. * <p/> * If a <tt>SessionManager</tt> instance is not set, a default one will be automatically created and * initialized appropriately for the the existing runtime environment. * * @param sessionManager delegate instance to use to support this manager's <tt>SessionManager</tt> method calls. */ public void setSessionManager(SessionManager sessionManager) { this.sessionManager = sessionManager; afterSessionManagerSet(); }
/** * Default no-arg constructor, internally creates a suitable default {@link SessionManager SessionManager} delegate * instance. */ public SessionsSecurityManager() { super(); this.sessionManager = new DefaultSessionManager(); applyCacheManagerToSessionManager(); }
protected void afterSessionManagerSet() { applyCacheManagerToSessionManager(); applyEventBusToSessionManager(); }
protected SessionsSecurityManager securityManager(List<Realm> realms) { SessionsSecurityManager securityManager = createSecurityManager(); securityManager.setAuthenticator(authenticator()); securityManager.setAuthorizer(authorizer()); securityManager.setRealms(realms); securityManager.setSessionManager(sessionManager()); securityManager.setEventBus(eventBus); if (cacheManager != null) { securityManager.setCacheManager(cacheManager); } return securityManager; }
/** * Ensures the internal delegate <code>SessionManager</code> is injected with the newly set * {@link #setCacheManager CacheManager} so it may use it for its internal caching needs. * <p/> * Note: This implementation only injects the CacheManager into the SessionManager if the SessionManager * instance implements the {@link CacheManagerAware CacheManagerAware} interface. */ protected void applyCacheManagerToSessionManager() { if (this.sessionManager instanceof CacheManagerAware) { ((CacheManagerAware) this.sessionManager).setCacheManager(getCacheManager()); } }
/** * Sets any configured EventBus on the SessionManager if necessary. * * @since 1.3 */ @Override protected void afterEventBusSet() { super.afterEventBusSet(); applyEventBusToSessionManager(); }
/** * Ensures the internal delegate <code>SessionManager</code> is injected with the newly set * {@link #setEventBus EventBus} so it may use it for its internal event needs. * <p/> * Note: This implementation only injects the EventBus into the SessionManager if the SessionManager * instance implements the {@link EventBusAware EventBusAware} interface. * * @since 1.3 */ protected void applyEventBusToSessionManager() { EventBus eventBus = getEventBus(); if (eventBus != null && this.sessionManager instanceof EventBusAware) { ((EventBusAware)this.sessionManager).setEventBus(eventBus); } }
protected SessionsSecurityManager securityManager(List<Realm> realms) { SessionsSecurityManager securityManager = createSecurityManager(); securityManager.setAuthenticator(authenticator()); securityManager.setAuthorizer(authorizer()); securityManager.setRealms(realms); securityManager.setSessionManager(sessionManager()); securityManager.setEventBus(eventBus); if (cacheManager != null) { securityManager.setCacheManager(cacheManager); } return securityManager; }
protected void afterSessionManagerSet() { applyCacheManagerToSessionManager(); applyEventBusToSessionManager(); }
/** * Ensures the internal delegate <code>SessionManager</code> is injected with the newly set * {@link #setCacheManager CacheManager} so it may use it for its internal caching needs. * <p/> * Note: This implementation only injects the CacheManager into the SessionManager if the SessionManager * instance implements the {@link CacheManagerAware CacheManagerAware} interface. */ protected void applyCacheManagerToSessionManager() { if (this.sessionManager instanceof CacheManagerAware) { ((CacheManagerAware) this.sessionManager).setCacheManager(getCacheManager()); } }
/** * Sets any configured EventBus on the SessionManager if necessary. * * @since 1.3 */ @Override protected void afterEventBusSet() { super.afterEventBusSet(); applyEventBusToSessionManager(); }
/** * Ensures the internal delegate <code>SessionManager</code> is injected with the newly set * {@link #setEventBus EventBus} so it may use it for its internal event needs. * <p/> * Note: This implementation only injects the EventBus into the SessionManager if the SessionManager * instance implements the {@link EventBusAware EventBusAware} interface. * * @since 1.3 */ protected void applyEventBusToSessionManager() { EventBus eventBus = getEventBus(); if (eventBus != null && this.sessionManager instanceof EventBusAware) { ((EventBusAware)this.sessionManager).setEventBus(eventBus); } }
private JDBCSessionDao getJDBCSessionDao(final Subject subject) { if (subject instanceof DelegatingSubject) { final DelegatingSubject delegatingSubject = (DelegatingSubject) subject; if (delegatingSubject.getSecurityManager() instanceof SessionsSecurityManager) { final SessionsSecurityManager securityManager = (SessionsSecurityManager) delegatingSubject.getSecurityManager(); if (securityManager.getSessionManager() instanceof DefaultSessionManager) { final DefaultSessionManager sessionManager = (DefaultSessionManager) securityManager.getSessionManager(); if (sessionManager.getSessionDAO() instanceof JDBCSessionDao) { return (JDBCSessionDao) sessionManager.getSessionDAO(); } } } } return null; } }
/** * 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(); }
/** * Ensures the internal delegate <code>SessionManager</code> is injected with the newly set * {@link #setCacheManager CacheManager} so it may use it for its internal caching needs. * <p/> * Note: This implementation only injects the CacheManager into the SessionManager if the SessionManager * instance implements the {@link CacheManagerAware CacheManagerAware} interface. */ protected void applyCacheManagerToSessionManager() { if (this.sessionManager instanceof CacheManagerAware) { ((CacheManagerAware) this.sessionManager).setCacheManager(getCacheManager()); } }
/** * Sets the underlying delegate {@link SessionManager} instance that will be used to support this implementation's * <tt>SessionManager</tt> method calls. * <p/> * This <tt>SecurityManager</tt> implementation does not provide logic to support the inherited * <tt>SessionManager</tt> interface, but instead delegates these calls to an internal * <tt>SessionManager</tt> instance. * <p/> * If a <tt>SessionManager</tt> instance is not set, a default one will be automatically created and * initialized appropriately for the the existing runtime environment. * * @param sessionManager delegate instance to use to support this manager's <tt>SessionManager</tt> method calls. */ public void setSessionManager(SessionManager sessionManager) { this.sessionManager = sessionManager; afterSessionManagerSet(); }
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(); }
/** * Sets the underlying delegate {@link SessionManager} instance that will be used to support this implementation's * <tt>SessionManager</tt> method calls. * <p/> * This <tt>SecurityManager</tt> implementation does not provide logic to support the inherited * <tt>SessionManager</tt> interface, but instead delegates these calls to an internal * <tt>SessionManager</tt> instance. * <p/> * If a <tt>SessionManager</tt> instance is not set, a default one will be automatically created and * initialized appropriately for the the existing runtime environment. * * @param sessionManager delegate instance to use to support this manager's <tt>SessionManager</tt> method calls. */ public void setSessionManager(SessionManager sessionManager) { this.sessionManager = sessionManager; afterSessionManagerSet(); }