CachingSecurityManager

A very basic starting point for the SecurityManager interface that merely provides logging and caching support. All actual {@code SecurityManager} method implementations are left to subclasses. <p/> <b>Change in 1.0</b> - a default {@code CacheManager} instance is <em>not</em> created by default during instantiation. As caching strategies can vary greatly depending on an application's needs, a {@code CacheManager} instance must be explicitly configured if caching across the framework is to be enabled.

Constructors

this
this()

Default no-arg constructor that will automatically attempt to initialize a default cacheManager

Members

Functions

afterCacheManagerSet
void afterCacheManagerSet()

Template callback to notify subclasses that a {@link hunt.shiro.cache.CacheManager CacheManager} has been set and is available for use via the {@link #getCacheManager getCacheManager()} method.

afterEventBusSet
void afterEventBusSet()

Template callback to notify subclasses that an {@link EventBus EventBus} has been set and is available for use via the {@link #getEventBus() getEventBus()} method.

applyEventBusToCacheManager
void applyEventBusToCacheManager()
destroy
void destroy()

Destroys the {@link #getCacheManager() cacheManager} via {@link LifecycleUtils#destroy LifecycleUtils.destroy}.

getCacheManager
CacheManager getCacheManager()

Returns the CacheManager used by this SecurityManager.

getEventBus
EventBus getEventBus()

Returns the {@code EventBus} used by this SecurityManager and potentially any of its children components.

setCacheManager
void setCacheManager(CacheManager cacheManager)

Sets the CacheManager used by this {@code SecurityManager} and potentially any of its children components. <p/> After the cacheManager attribute has been set, the template method {@link #afterCacheManagerSet afterCacheManagerSet()} is executed to allow subclasses to adjust when a cacheManager is available.

setEventBus
void setEventBus(EventBus eventBus)

Sets the EventBus used by this {@code SecurityManager} and potentially any of its children components. <p/> After the eventBus attribute has been set, the template method {@link #afterEventBusSet() afterEventBusSet()} is executed to allow subclasses to adjust when a eventBus is available.

Inherited Members

From SecurityManager

login
Subject login(Subject subject, AuthenticationToken authenticationToken)

Logs in the specified Subject using the given {@code authenticationToken}, returning an updated Subject instance reflecting the authenticated state if successful or throwing {@code AuthenticationException} if it is not. <p/> Note that most application developers should probably not call this method directly unless they have a good reason for doing so. The preferred way to log in a Subject is to call <code>subject.{@link hunt.shiro.subject.Subject#login login(authenticationToken)}</code> (usually after acquiring the Subject by calling {@link hunt.shiro.SecurityUtils#getSubject() SecurityUtils.getSubject()}). <p/> Framework developers on the other hand might find calling this method directly useful in certain cases.

logout
void logout(Subject subject)

Logs out the specified Subject from the system. <p/> Note that most application developers should not call this method unless they have a good reason for doing so. The preferred way to logout a Subject is to call <code>{@link hunt.shiro.subject.Subject#logout Subject.logout()}</code>, not the {@code SecurityManager} directly. <p/> Framework developers on the other hand might find calling this method directly useful in certain cases.

createSubject
Subject createSubject(SubjectContext context)

Creates a {@code Subject} instance reflecting the specified contextual data. <p/> The context can be anything needed by this {@code SecurityManager} to construct a {@code Subject} instance. Most Shiro end-users will never call this method - it exists primarily for framework development and to support any underlying custom {@link SubjectFactory SubjectFactory} implementations that may be used by the {@code SecurityManager}. <h4>Usage</h4> After calling this method, the returned instance is <em>not</em> bound to the application for further use. Callers are expected to know that {@code Subject} instances have local scope only and any other further use beyond the calling method must be managed explicitly.

From Destroyable

destroy
void destroy()

Called when this object is being destroyed, allowing any necessary cleanup of internal resources.

From CacheManagerAware

setCacheManager
void setCacheManager(CacheManager cacheManager)

Sets the available CacheManager instance on this component.

From EventBusAware

setEventBus
void setEventBus(EventBus bus)

Sets the available {@code EventBus} that may be used for publishing and subscribing to/from events.

Meta