websocket
This commit is contained in:
@@ -120,6 +120,26 @@ impl AuthorizationCodeRequest {
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct VerifyClientAuthorizationRequest {
|
||||
user_id: uuid::Uuid,
|
||||
client_id: uuid::Uuid,
|
||||
}
|
||||
|
||||
impl VerifyClientAuthorizationRequest {
|
||||
pub fn new(user_id: uuid::Uuid, client_id: uuid::Uuid) -> Self {
|
||||
Self { client_id, user_id }
|
||||
}
|
||||
|
||||
pub fn user_id(&self) -> uuid::Uuid {
|
||||
self.user_id
|
||||
}
|
||||
|
||||
pub fn client_id(&self) -> uuid::Uuid {
|
||||
self.client_id
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
pub struct TokenClaims<T>
|
||||
where
|
||||
@@ -180,7 +200,11 @@ where
|
||||
let iat = now.unix_timestamp() as usize;
|
||||
let exp = (now + time::Duration::days(30)).unix_timestamp() as usize;
|
||||
|
||||
let claims = TokenClaims { sub, iat, exp };
|
||||
let claims = TokenClaims {
|
||||
sub: serde_qs::to_string(&sub)?,
|
||||
iat,
|
||||
exp,
|
||||
};
|
||||
|
||||
let token = encode(
|
||||
&Header::default(),
|
||||
|
Reference in New Issue
Block a user