DefaultEnvironment

Simple/default {@code Environment} implementation that stores Shiro objects as key-value pairs in a {@link java.util.Map Map} instance. The key is the object name, the value is the object itself.

Constructors

this
this()

Creates a new instance with a thread-safe {@link ConcurrentHashMap} backing map.

this
this(Map!(string, Object) seed)

Creates a new instance with the specified backing map.

Members

Functions

destroy
void destroy()
Undocumented in source. Be warned that the author may not have intended to support it.
getObject
Object getObject(string name)
Undocumented in source. Be warned that the author may not have intended to support it.
getObjects
Map!(string, Object) getObjects()

Returns the live (modifiable) internal objects collection.

getSecurityManager
SecurityManager getSecurityManager()

Returns the application's {@code SecurityManager} instance accessible in the backing map using the {@link #getSecurityManagerName() securityManagerName} property as the lookup key. <p/> This implementation guarantees that a non-null instance is always returned, as this is expected for Environment API end-users. If subclasses have the need to perform the map lookup without this guarantee (for example, during initialization when the instance may not have been added to the map yet), the {@link #lookupSecurityManager()} method is provided as an alternative.

getSecurityManagerName
string getSecurityManagerName()

Returns the name of the {@link SecurityManager} instance in the backing map. Used as a key to lookup the instance. Unless set otherwise, the default is {@code securityManager}.

lookupSecurityManager
SecurityManager lookupSecurityManager()

Looks up the {@code SecurityManager} instance in the backing map without performing any non-null guarantees.

setObject
void setObject(string name, Object instance)
Undocumented in source. Be warned that the author may not have intended to support it.
setSecurityManager
void setSecurityManager(SecurityManager securityManager)
Undocumented in source. Be warned that the author may not have intended to support it.
setSecurityManagerName
void setSecurityManagerName(string securityManagerName)

Sets the name of the {@link SecurityManager} instance in the backing map. Used as a key to lookup the instance. Unless set otherwise, the default is {@code securityManager}.

Variables

DEFAULT_SECURITY_MANAGER_KEY
enum string DEFAULT_SECURITY_MANAGER_KEY;

The default name under which the application's {@code SecurityManager} instance may be acquired, equal to {@code securityManager}.

objects
Map!(string, Object) objects;
Undocumented in source.

Inherited Members

From NamedObjectEnvironment

getObject
Object getObject(string name)

Returns the object in Shiro's environment with the specified name and type or {@code null} if no object with that name was found.

From Destroyable

destroy
void destroy()

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

Meta