Tabnine Logo
org.apache.shiro.session.mgt.eis
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.shiro.session.mgt.eis

Best Java code snippets using org.apache.shiro.session.mgt.eis (Showing top 20 results out of 315)

origin: apache/shiro

/**
 * Calls {@code super.create(session)}, then caches the session keyed by the returned {@code sessionId}, and then
 * returns this {@code sessionId}.
 *
 * @param session Session object to create in the EIS and then cache.
 */
public Serializable create(Session session) {
  Serializable sessionId = super.create(session);
  cache(session, sessionId);
  return sessionId;
}
origin: apache/shiro

public EnterpriseCacheSessionDAO() {
  setCacheManager(new AbstractCacheManager() {
    @Override
    protected Cache<Serializable, Session> createCache(String name) throws CacheException {
      return new MapCache<Serializable, Session>(name, new ConcurrentHashMap<Serializable, Session>());
    }
  });
}
origin: apache/shiro

/**
 * Removes the specified session from any cache and then permanently deletes the session from the EIS by
 * delegating to {@link #doDelete}.
 *
 * @param session the session to remove from caches and permanently delete from the EIS.
 */
public void delete(Session session) {
  uncache(session);
  doDelete(session);
}
origin: wuyouzhuguli/FEBS-Shiro

@Override
public boolean forceLogout(String sessionId) {
  Session session = sessionDAO.readSession(sessionId);
  session.setTimeout(0);
  session.stop();
  sessionDAO.delete(session);
  return true;
}
origin: apache/shiro

/**
 * Attempts to acquire the Session from the cache first using the session ID as the cache key.  If no session
 * is found, {@code super.readSession(sessionId)} is called to perform the actual retrieval.
 *
 * @param sessionId the id of the session to retrieve from the EIS.
 * @return the session identified by {@code sessionId} in the EIS.
 * @throws UnknownSessionException if the id specified does not correspond to any session in the cache or EIS.
 */
public Session readSession(Serializable sessionId) throws UnknownSessionException {
  Session s = getCachedSession(sessionId);
  if (s == null) {
    s = super.readSession(sessionId);
  }
  return s;
}
origin: apache/shiro

protected Serializable doCreate(Session session) {
  Serializable sessionId = generateSessionId(session);
  assignSessionId(session, sessionId);
  storeSession(sessionId, session);
  return sessionId;
}
origin: apache/shiro

protected Session retrieveSessionFromDataSource(Serializable sessionId) throws UnknownSessionException {
  return sessionDAO.readSession(sessionId);
}
origin: apache/shiro

/**
 * Default no-arg constructor that defaults the {@link #setSessionIdGenerator sessionIdGenerator} to be a
 * {@link org.apache.shiro.session.mgt.eis.JavaUuidSessionIdGenerator}.
 */
public AbstractSessionDAO() {
  this.sessionIdGenerator = new JavaUuidSessionIdGenerator();
}
origin: apache/shiro

protected void delete(Session session) {
  sessionDAO.delete(session);
}
origin: apache/shiro

/**
 * Creates the session by delegating EIS creation to subclasses via the {@link #doCreate} method, and then
 * asserting that the returned sessionId is not null.
 *
 * @param session Session object to create in the EIS and associate with an ID.
 */
public Serializable create(Session session) {
  Serializable sessionId = doCreate(session);
  verifySessionId(sessionId);
  return sessionId;
}
origin: apache/shiro

protected Serializable doCreate(Session session) {
  Serializable sessionId = generateSessionId(session);
  assignSessionId(session, sessionId);
  return sessionId;
}
origin: apache/shiro

protected void onChange(Session session) {
  sessionDAO.update(session);
}
origin: apache/shiro

/**
 * Caches the specified session under the cache entry key of {@code sessionId}.
 *
 * @param session   the session to cache
 * @param sessionId the session id, to be used as the cache entry key.
 * @since 1.0
 */
protected void cache(Session session, Serializable sessionId) {
  if (session == null || sessionId == null) {
    return;
  }
  Cache<Serializable, Session> cache = getActiveSessionsCacheLazy();
  if (cache == null) {
    return;
  }
  cache(session, sessionId, cache);
}
origin: apache/shiro

/**
 * Returns the cached session with the corresponding {@code sessionId} or {@code null} if there is
 * no session cached under that id (or if there is no Cache).
 *
 * @param sessionId the id of the cached session to acquire.
 * @return the cached session with the corresponding {@code sessionId}, or {@code null} if the session
 *         does not exist or is not cached.
 */
protected Session getCachedSession(Serializable sessionId) {
  Session cached = null;
  if (sessionId != null) {
    Cache<Serializable, Session> cache = getActiveSessionsCacheLazy();
    if (cache != null) {
      cached = getCachedSession(sessionId, cache);
    }
  }
  return cached;
}
origin: apache/shiro

protected SessionDAO sessionDAO() {
  return new MemorySessionDAO();
}
origin: apache/shiro

protected Collection<Session> getActiveSessions() {
  Collection<Session> active = sessionDAO.getActiveSessions();
  return active != null ? active : Collections.<Session>emptySet();
}
origin: apache/shiro

/**
 * Persists the given session instance to an underlying EIS (Enterprise Information System).  This implementation
 * delegates and calls
 * <code>this.{@link SessionDAO sessionDAO}.{@link SessionDAO#create(org.apache.shiro.session.Session) create}(session);<code>
 *
 * @param session the Session instance to persist to the underlying EIS.
 */
protected void create(Session session) {
  if (log.isDebugEnabled()) {
    log.debug("Creating new EIS record for new session instance [" + session + "]");
  }
  sessionDAO.create(session);
}
origin: apache/shiro

/**
 * Returns the active sessions cache, but if that cache instance is null, first lazily creates the cache instance
 * via the {@link #createActiveSessionsCache()} method and then returns the instance.
 * <p/>
 * Note that this method will only return a non-null value code if the {@code CacheManager} has been set.  If
 * not set, there will be no cache.
 *
 * @return the active sessions cache instance.
 */
private Cache<Serializable, Session> getActiveSessionsCacheLazy() {
  if (this.activeSessions == null) {
    this.activeSessions = createActiveSessionsCache();
  }
  return activeSessions;
}
origin: apache/shiro

public void update(Session session) throws UnknownSessionException {
  storeSession(session.getId(), session);
}
origin: apache/shiro

public DefaultSessionManager() {
  this.deleteInvalidSessions = true;
  this.sessionFactory = new SimpleSessionFactory();
  this.sessionDAO = new MemorySessionDAO();
}
org.apache.shiro.session.mgt.eis

Most used classes

  • EnterpriseCacheSessionDAO
    SessionDAO implementation that relies on an enterprise caching product as the EIS system of record f
  • SessionDAO
    Data Access Object design pattern specification to enable Session access to an EIS (Enterprise Infor
  • AbstractSessionDAO
    An abstract SessionDAO implementation that performs some sanity checks on session creation and readi
  • CachingSessionDAO
    An CachingSessionDAO is a SessionDAO that provides a transparent caching layer between the component
  • JavaUuidSessionIdGenerator
    SessionIdGenerator that generates String values of JDK java.util.UUID's as the session IDs.
  • SessionIdGenerator,
  • RandomSessionIdGenerator
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now