blob: 3d455234d7e6782c8ff0d961b8b2c68a0f1da544 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
use async_session::{Result, Session, SessionStore};
use async_trait::async_trait;
use shared_svc::cache::RedisManager;
use tracing::instrument;
#[derive(Debug, Clone)]
pub struct AuthService {
cache: RedisManager,
}
impl AuthService {
pub fn new(cache: &RedisManager) -> Self {
Self {
cache: cache.clone(),
}
}
}
#[async_trait]
impl SessionStore for AuthService {
#[doc = " Get a session from the storage backend."]
#[doc = ""]
#[doc = " The input is expected to be the value of an identifying"]
#[doc = " cookie. This will then be parsed by the session middleware"]
#[doc = " into a session if possible"]
#[instrument(skip(self))]
async fn load_session(&self, cookie_value: String) -> Result<Option<Session>> {
todo!()
}
#[doc = " Store a session on the storage backend."]
#[doc = ""]
#[doc = " The return value is the value of the cookie to store for the"]
#[doc = " user that represents this session"]
#[instrument(skip(self))]
async fn store_session(&self, session: Session) -> Result<Option<String>> {
todo!()
}
#[doc = " Remove a session from the session store"]
#[instrument(skip(self))]
async fn destroy_session(&self, session: Session) -> Result {
todo!()
}
#[doc = " Empties the entire store, destroying all sessions"]
#[instrument(skip(self))]
async fn clear_store(&self) -> Result {
todo!()
}
}
|