protected void onExpiration(Session session) { if (session instanceof SimpleSession) { ((SimpleSession) session).setExpired(true); } onChange(session); }
/** * @see Session#setAttribute(Object key, Object value) */ public void setAttribute(Object attributeKey, Object value) throws InvalidSessionException { if (value == null) { removeAttribute(attributeKey); } else { sessionManager.setAttribute(this.key, attributeKey, value); } }
private void enableSessionValidationIfNecessary() { SessionValidationScheduler scheduler = getSessionValidationScheduler(); if (isSessionValidationSchedulerEnabled() && (scheduler == null || !scheduler.isEnabled())) { enableSessionValidation(); } }
@Override protected void onStop(Session session) { if (session instanceof SimpleSession) { SimpleSession ss = (SimpleSession) session; Date stopTs = ss.getStopTimestamp(); ss.setLastAccessTime(stopTs); } onChange(session); }
public Session start(SessionContext context) { Session session = createSession(context); applyGlobalSessionTimeout(session); onStart(session, context); notifyStart(session); //Don't expose the EIS-tier Session object to the client-tier: return createExposedSession(session, context); }
protected Session newSessionInstance(SessionContext context) { return getSessionFactory().createSession(context); }
protected void validate(Session session, SessionKey key) throws InvalidSessionException { try { doValidate(session); } catch (ExpiredSessionException ese) { onExpiration(session, ese, key); throw ese; } catch (InvalidSessionException ise) { onInvalidation(session, ise, key); throw ise; } }
/** * @see org.apache.shiro.session.Session#getId() */ public Serializable getId() { return key.getSessionId(); }
@Override protected void afterStopped(Session session) { if (isDeleteInvalidSessions()) { delete(session); } }
/** * Immediately {@link #throwImmutableException() throws} an <code>InvalidSessionException</code> in all * cases because this proxy is immutable. */ public void touch() throws InvalidSessionException { throwImmutableException(); }
/** * @see org.apache.shiro.session.Session#getLastAccessTime() */ public Date getLastAccessTime() { //can't cache - only business pojo knows the accurate time: return sessionManager.getLastAccessTime(key); }
public String getHost() { if (host == null) { host = sessionManager.getHost(key); } return host; }
/** * @see org.apache.shiro.session.Session#getAttributeKeys */ public Collection<Object> getAttributeKeys() throws InvalidSessionException { return sessionManager.getAttributeKeys(key); }
/** * @see org.apache.shiro.session.Session#getAttribute(Object key) */ public Object getAttribute(Object attributeKey) throws InvalidSessionException { return sessionManager.getAttribute(this.key, attributeKey); }
/** * @see Session#removeAttribute(Object key) */ public Object removeAttribute(Object attributeKey) throws InvalidSessionException { return sessionManager.removeAttribute(this.key, attributeKey); } }
public boolean isValid(SessionKey key) { try { checkValid(key); return true; } catch (InvalidSessionException e) { return false; } }
/** * Immediately {@link #throwImmutableException() throws} an <code>InvalidSessionException</code> in all * cases because this proxy is immutable. */ public void stop() throws InvalidSessionException { throwImmutableException(); }
/** * Immediately {@link #throwImmutableException() throws} an <code>InvalidSessionException</code> in all * cases because this proxy is immutable. */ public void setTimeout(long maxIdleTimeInMillis) throws InvalidSessionException { throwImmutableException(); }
/** * Immediately {@link #throwImmutableException() throws} an <code>InvalidSessionException</code> in all * cases because this proxy is immutable. */ public void setAttribute(Object key, Object value) throws InvalidSessionException { throwImmutableException(); }