/** {@inheritDoc} */ @Override public void updateAuthenticationResultActivity(@Nonnull final AuthenticationResult result) throws SessionException { final String flowId = result.getAuthenticationFlowId(); final AuthenticationFlowDescriptor flow = sessionManager.getAuthenticationFlowDescriptor(flowId); if (flow != null) { try { if (!sessionManager.getStorageService().updateExpiration(getId(), result.getAuthenticationFlowId(), result.getLastActivityInstant() + flow.getInactivityTimeout() + AuthenticationFlowDescriptor.STORAGE_EXPIRATION_OFFSET)) { log.warn("Skipping update, AuthenticationResult for flow {} in session {} not found in storage", flowId, getId()); } } catch (final IOException e) { log.error("Exception updating AuthenticationResult expiration for session {} and flow {}", getId(), flowId, e); if (!sessionManager.isMaskStorageFailure()) { throw new SessionException("Exception updating AuthenticationResult expiration in storage", e); } } } else { log.warn("No flow descriptor installed for ID {}, unable to update result in storage", flowId); } }
/** {@inheritDoc} */ @Override @Duration public void setLastActivityInstant(@Duration @Positive final long instant) throws SessionException { final long exp = instant + sessionManager.getSessionTimeout() + sessionManager.getSessionSlop(); log.debug("Updating expiration of master record for session {} to {}", getId(), new DateTime(exp)); try { sessionManager.getStorageService().updateExpiration( getId(), StorageBackedSessionManager.SESSION_MASTER_KEY, exp); super.setLastActivityInstant(instant); } catch (final IOException e) { log.error("Exception updating expiration of master record for session {}", getId(), e); if (!sessionManager.isMaskStorageFailure()) { throw new SessionException("Exception updating expiration of session record", e); } } }