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
52
53
54
55
56
57
58
59
60
// use chrono::{DateTime, Utc};
// use jwt::Token;
// use serde::Deserialize;
// use uuid::Uuid;
// #[derive(Debug, Deserialize, Clone, Hash, PartialEq, Eq)]
// pub struct RefreshTokenClaims {
// /// Type
// pub typ: String,
// /// Issuer
// pub iss: String,
// /// Audience
// pub aud: String,
// /// Issued at
// pub iat: DateTime<Utc>,
// /// Not before
// pub nbf: DateTime<Utc>,
// /// Expiration time.
// pub exp: DateTime<Utc>,
// /// User id
// pub uid: Uuid,
// /// Session id
// pub sid: Uuid,
// }
// #[derive(Debug, Deserialize, Clone, Hash, PartialEq, Eq)]
// pub struct SessionTokenClaims {
// /// Type
// pub typ: String,
// /// Issuer
// pub iss: String,
// /// Audience
// pub aud: String,
// /// Issued at
// pub iat: DateTime<Utc>,
// /// Not before
// pub nbf: DateTime<Utc>,
// /// Expiration time.
// pub exp: DateTime<Utc>,
// /// User id
// pub uid: Uuid,
// /// Session id
// pub sid: Uuid,
// /// User roles
// // TODO: De-stringify the roles.
// pub rol: Vec<String>,
// /// User permissions
// // TODO: De-stringify the permissions.
// pub prm: Vec<String>,
// }
// pub fn deserialize_jwt<T>(
// token: &'_ str,
// ) -> std::result::Result<jwt::Token<jwt::Header, T, jwt::Unverified<'_>>, jwt::Error>
// where
// T: serde::de::DeserializeOwned,
// {
// let token: Token<jwt::Header, T, _> = Token::parse_unverified(token)?;
// Ok(token)
// }