pub struct InMemoryAccountBackend { /* private fields */ }Expand description
In-memory account backend (default). Lost on restart — production deployments should swap in a persistent backend so refresh tokens survive a redeploy.
Implementations§
Trait Implementations§
Source§impl AccountBackend for InMemoryAccountBackend
impl AccountBackend for InMemoryAccountBackend
Source§fn upsert(&self, account: &Account)
fn upsert(&self, account: &Account)
Insert or refresh an account link. The
(provider_id, account_id)
pair is the natural key — repeated calls for the same pair
update the token bundle and updated_at on the existing row.Source§fn find_by_provider(
&self,
provider_id: &str,
account_id: &str,
) -> Option<Account>
fn find_by_provider( &self, provider_id: &str, account_id: &str, ) -> Option<Account>
Find an account by provider identity. Returns
None if the user
hasn’t linked this provider yet.Source§fn find_for_user(&self, user_id: &str) -> Vec<Account>
fn find_for_user(&self, user_id: &str) -> Vec<Account>
Every account linked to a user. The
/api/auth/me endpoint uses
this to render “you’re connected via Google + GitHub” in the UI
and to gate “unlink” affordances behind “user has another way to
sign in” checks.Source§fn unlink(&self, provider_id: &str, account_id: &str) -> bool
fn unlink(&self, provider_id: &str, account_id: &str) -> bool
Remove a single provider link. Returns
true if a row was removed.Source§fn list_all(&self) -> Vec<Account>
fn list_all(&self) -> Vec<Account>
Every account in the store. Used by
AccountStore::list_all_unfiltered
to power the Studio admin inspector. Backends that can stream
(SQLite, Postgres) just SELECT *; the in-memory backend
returns its full map.Source§fn delete_for_user(&self, user_id: &str) -> usize
fn delete_for_user(&self, user_id: &str) -> usize
Remove every account link for a user. Used during account
deletion to ensure no OAuth references survive past a user row
delete. Default implementation walks
find_for_user + unlink;
SQL backends can override with a single DELETE.Auto Trait Implementations§
impl !Freeze for InMemoryAccountBackend
impl RefUnwindSafe for InMemoryAccountBackend
impl Send for InMemoryAccountBackend
impl Sync for InMemoryAccountBackend
impl Unpin for InMemoryAccountBackend
impl UnsafeUnpin for InMemoryAccountBackend
impl UnwindSafe for InMemoryAccountBackend
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more