Class AbstractSessionDAO

java.lang.Object
org.apache.shiro.session.mgt.eis.AbstractSessionDAO
All Implemented Interfaces:
SessionDAO
Direct Known Subclasses:
CachingSessionDAO, MemorySessionDAO

public abstract class AbstractSessionDAO extends Object implements SessionDAO
An abstract SessionDAO implementation that performs some sanity checks on session creation and reading and allows for pluggable Session ID generation strategies if desired. The SessionDAO update and delete methods are left to subclasses.

Session ID Generation

This class also allows for plugging in a SessionIdGenerator for custom ID generation strategies. This is optional, as the default generator is probably sufficient for most cases. Subclass implementations that do use a generator (default or custom) will want to call the generateSessionId(org.apache.shiro.session.Session) method from within their doCreate(org.apache.shiro.session.Session) implementations.

Subclass implementations that rely on the EIS data store to generate the ID automatically (e.g. when the session ID is also an auto-generated primary key), they can simply ignore the SessionIdGenerator concept entirely and just return the data store's ID from the doCreate(org.apache.shiro.session.Session) implementation.

Since:
1.0