khonsulabs / bonsaidb

A developer-friendly document database that grows with you, written in Rust
https://bonsaidb.io/
Apache License 2.0
1.03k stars 37 forks source link

Support automatic re-authentication for Sessions #275

Open ecton opened 1 year ago

ecton commented 1 year ago

After a good discussion with @daxpedda, we want to implement a "resume session" feature to allow re-establishing sessions after a configurable amount of time. We can also enable session reconnection at the TLS level both in http and fabruic which would alleviate the need protocol-level session resuming. However, I think a combination of both approaches is ideal.

The TLS-level implementation can be transparent, but there is limited ability to customize the behavior on a per-connection or per-identity basis. Protocol-level session resuming could allow different identities the ability to resume connections for longer periods of time.

The protocol-level implementation would generate new tokens periodically that the client can send back on reconnect to resume a recently disconnected session. If the server honors the token, the session can be resumed on the Client without reporting a disconnection error or unauthenticated error.

Originally posted by @ecton in https://github.com/khonsulabs/bonsaidb/issues/264#issuecomment-1409452735