Trait mas_storage::oauth2::OAuth2SessionRepository
source · pub trait OAuth2SessionRepository: Send + Sync {
type Error;
// Required methods
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<Session>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user: Option<&'life4 User>,
user_session: Option<&'life5 BrowserSession>,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait;
fn finish<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
session: Session,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn finish_bulk<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
filter: OAuth2SessionFilter<'life2>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: OAuth2SessionFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<Session>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: OAuth2SessionFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn record_batch_activity<'life0, 'async_trait>(
&'life0 mut self,
activity: Vec<(Ulid, DateTime<Utc>, Option<IpAddr>)>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn record_user_agent<'life0, 'async_trait>(
&'life0 mut self,
session: Session,
user_agent: UserAgent,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn add_from_browser_session<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user_session: &'life4 BrowserSession,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait { ... }
fn add_from_client_credentials<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait { ... }
}
Expand description
An OAuth2SessionRepository
helps interacting with Session
saved in the storage backend
Required Associated Types§
Required Methods§
sourcefn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<Session>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn lookup<'life0, 'async_trait>(
&'life0 mut self,
id: Ulid,
) -> Pin<Box<dyn Future<Output = Result<Option<Session>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
sourcefn add<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user: Option<&'life4 User>,
user_session: Option<&'life5 BrowserSession>,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
fn add<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user: Option<&'life4 User>,
user_session: Option<&'life5 BrowserSession>,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Create a new Session
with the given parameters
Returns the newly created Session
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsclient
: TheClient
which created theSession
user
: TheUser
for which the session should be created, if anyuser_session
: TheBrowserSession
of the user which completed the authorization, if anyscope
: The [Scope
] of theSession
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn finish<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
session: Session,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn finish<'life0, 'life1, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
session: Session,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
sourcefn finish_bulk<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
filter: OAuth2SessionFilter<'life2>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn finish_bulk<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
clock: &'life1 dyn Clock,
filter: OAuth2SessionFilter<'life2>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Mark all the Session
matching the given filter as finished
Returns the number of sessions affected
§Parameters
clock
: The clock used to generate timestampsfilter
: The filter parameters
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: OAuth2SessionFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<Session>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn list<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: OAuth2SessionFilter<'life1>,
pagination: Pagination,
) -> Pin<Box<dyn Future<Output = Result<Page<Session>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List Session
s matching the given filter and pagination parameters
§Parameters
filter
: The filter parameterspagination
: The pagination parameters
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: OAuth2SessionFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn count<'life0, 'life1, 'async_trait>(
&'life0 mut self,
filter: OAuth2SessionFilter<'life1>,
) -> Pin<Box<dyn Future<Output = Result<usize, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Count Session
s matching the given filter
§Parameters
filter
: The filter parameters
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn record_batch_activity<'life0, 'async_trait>(
&'life0 mut self,
activity: Vec<(Ulid, DateTime<Utc>, Option<IpAddr>)>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn record_batch_activity<'life0, 'async_trait>(
&'life0 mut self,
activity: Vec<(Ulid, DateTime<Utc>, Option<IpAddr>)>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Record a batch of Session
activity
§Parameters
activity
: A list of tuples containing the session ID, the last activity timestamp and the IP address of the client
§Errors
Returns Self::Error
if the underlying repository fails
Provided Methods§
sourcefn add_from_browser_session<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user_session: &'life4 BrowserSession,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn add_from_browser_session<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
user_session: &'life4 BrowserSession,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Create a new Session
out of a Client
and a BrowserSession
Returns the newly created Session
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsclient
: TheClient
which created theSession
user_session
: TheBrowserSession
of the user which completed the authorizationscope
: The [Scope
] of theSession
§Errors
Returns Self::Error
if the underlying repository fails
sourcefn add_from_client_credentials<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
fn add_from_client_credentials<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 mut self,
rng: &'life1 mut (dyn RngCore + Send),
clock: &'life2 dyn Clock,
client: &'life3 Client,
scope: Scope,
) -> Pin<Box<dyn Future<Output = Result<Session, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Create a new Session
for a Client
using the client credentials
flow
Returns the newly created Session
§Parameters
rng
: The random number generator to useclock
: The clock used to generate timestampsclient
: TheClient
which created theSession
scope
: The [Scope
] of theSession
§Errors
Returns Self::Error
if the underlying repository fails