java.lang.Object
i2p.susi.webmail.WebMail.SessionObject
- All Implemented Interfaces:
NewMailListener, EventListener, HttpSessionBindingListener
- Enclosing class:
WebMail
private static class WebMail.SessionObjectextends Object implements HttpSessionBindingListener, NewMailListener
Data structure to hold any persistent data (to store them in session dictionary).
Field Summary
Modifier and TypeFieldDescriptionprivate StringKey for signing session identifiers.private StringLocal password verification for session protection @since 0.9.70+.Attachments staged for this session, cleared and deleted together.The message caches, by folder.(package private) StringError from the threaded connector, null if it connected.(package private) StringUIDL of the draft being edited.(package private) StringError message to show the user.(package private) StringThe mail server host.(package private) StringPath prefix for the images' links.(package private) StringInfo message to show the user.(package private) booleanTrue while the threaded connector is fetching.(package private) booleanTrue when serving the mobile layout.Cached error text from the last render, to avoid repeating it.Cached informational text from the last render, to avoid repeating it.Status message slot for the session, alongside lastError and lastInfo.final LogLog scoped to this session's requests.(package private) POP3MailBoxThe connected mailbox, null until login succeeds.private static final intHow many issued nonces stay valid.(package private) intNew messages from the last fetch, -1 until it completes.The form nonces still accepted.(package private) StringThe login password.booleanP-R-G.(package private) intSMTP port this session sends through.(package private) StringPath prefix for the theme's links.(package private) StringThe login user.Constructor Summary
ConstructorsMethod Summary
Modifier and TypeMethodDescriptionvoidRecord a form nonce for the session.voidClear the attachment list.voidDelete attachment files.voidfoundNewMail(boolean yes) Handle new mail notification.private static StringhashPassword(String password, String salt) PBKDF2 hash for password verification with high iteration count.booleanisValidNonce(String nonce) Check and consume a form nonce.voidsetLocalPassword(String password) Hash and store a local password.voidNo-op, nothing to do when the session is bound.voidCalled when the session attribute is removed.booleanverifyLocalPassword(String password) Verify a password against the stored hash.
Field Details
smtpPort
int smtpPortSMTP port this session sends through.mailbox
POP3MailBox mailboxThe connected mailbox, null until login succeeds.caches
isFetching
boolean isFetchingTrue while the threaded connector is fetching.connectError
String connectErrorError from the threaded connector, null if it connected.newMails
int newMailsNew messages from the last fetch, -1 until it completes.user
String userThe login user.pass
String passThe login password.host
String hostThe mail server host.error
String errorError message to show the user.info
String infoInfo message to show the user.draftUIDL
String draftUIDLUIDL of the draft being edited._sessionSalt
Local password verification for session protection @since 0.9.70+._sessionKey
Key for signing session identifiers.attachments
Attachments staged for this session, cleared and deleted together.reallyDelete
public boolean reallyDeleteP-R-G.themePath
String themePathPath prefix for the theme's links.imgPath
String imgPathPath prefix for the images' links.isMobile
boolean isMobileTrue when serving the mobile layout.nonces
MAX_NONCES
log
Log scoped to this session's requests.lastError
Cached error text from the last render, to avoid repeating it.lastInfo
Cached informational text from the last render, to avoid repeating it.lastNotice
Status message slot for the session, alongside lastError and lastInfo.
Constructor Details
SessionObject
SessionObject(Log log) Creates the session state for one browser.- Parameters:
log- the logger to report through
Method Details
setLocalPassword
Hash and store a local password.- Parameters:
password- the plain text password to store
verifyLocalPassword
Verify a password against the stored hash.- Parameters:
password- the password to check- Returns:
- true if password matches
hashPassword
valueBound
No-op, nothing to do when the session is bound.- Specified by:
valueBoundin interfaceHttpSessionBindingListener
valueUnbound
Called when the session attribute is removed.- Specified by:
valueUnboundin interfaceHttpSessionBindingListener
foundNewMail
public void foundNewMail(boolean yes) Handle new mail notification.- Specified by:
foundNewMailin interfaceNewMailListener- Parameters:
yes- true if new mail was found
addNonce
Record a form nonce for the session.- Parameters:
nonce- the nonce to record
isValidNonce
Check and consume a form nonce.- Parameters:
nonce- the nonce to check- Returns:
- true if the nonce was issued and not yet used
clearAttachments
public void clearAttachments()Clear the attachment list.deleteAttachments
public void deleteAttachments()Delete attachment files.