/** * Saves the subject's state to the subject's {@link org.apache.shiro.subject.Subject#getSession() session} only * if {@link #isSessionStorageEnabled(Subject) sessionStorageEnabled(subject)}. If session storage is not enabled * for the specific {@code Subject}, this method does nothing. * <p/> * In either case, the argument {@code Subject} is returned directly (a new Subject instance is not created). * * @param subject the Subject instance for which its state will be created or updated. * @return the same {@code Subject} passed in (a new Subject instance is not created). */ public Subject save(Subject subject) { if (isSessionStorageEnabled(subject)) { saveToSession(subject); } else { log.trace("Session storage of subject state for Subject [{}] has been disabled: identity and " + "authentication state are expected to be initialized on every request or invocation.", subject); } return subject; }
/** * Saves the subject's state to the subject's {@link org.apache.shiro.subject.Subject#getSession() session} only * if {@link #isSessionStorageEnabled(Subject) sessionStorageEnabled(subject)}. If session storage is not enabled * for the specific {@code Subject}, this method does nothing. * <p/> * In either case, the argument {@code Subject} is returned directly (a new Subject instance is not created). * * @param subject the Subject instance for which its state will be created or updated. * @return the same {@code Subject} passed in (a new Subject instance is not created). */ public Subject save(Subject subject) { if (isSessionStorageEnabled(subject)) { saveToSession(subject); } else { log.trace("Session storage of subject state for Subject [{}] has been disabled: identity and " + "authentication state are expected to be initialized on every request or invocation.", subject); } return subject; }