diff --git a/model/src/lib.rs b/model/src/lib.rs index b66b30b..408b198 100644 --- a/model/src/lib.rs +++ b/model/src/lib.rs @@ -1,4 +1,6 @@ use serde::{Deserialize, Serialize}; +use chrono::prelude::*; +use std::collections::HashSet; #[derive(PartialEq, Eq, Debug, Serialize, Deserialize, Clone)] pub struct BindRequest { @@ -36,3 +38,10 @@ pub struct Group { pub display_name: String, pub users: Vec, } + +#[derive(Clone, Serialize, Deserialize)] +pub struct JWTClaims { + pub exp: DateTime, + pub user: String, + pub groups: HashSet, +} diff --git a/src/infra/tcp_server.rs b/src/infra/tcp_server.rs index 67e6f33..0f01155 100644 --- a/src/infra/tcp_server.rs +++ b/src/infra/tcp_server.rs @@ -18,7 +18,6 @@ use futures_util::TryFutureExt; use hmac::{Hmac, NewMac}; use jwt::{SignWithKey, VerifyWithKey}; use log::*; -use serde::{Deserialize, Serialize}; use sha2::Sha512; use std::collections::HashSet; use std::path::PathBuf; @@ -27,13 +26,6 @@ use time::ext::NumericalDuration; type Token = jwt::Token; type SignedToken = Token; -#[derive(Serialize, Deserialize)] -struct JWTClaims { - exp: DateTime, - user: String, - groups: HashSet, -} - async fn index(req: HttpRequest) -> actix_web::Result { let mut path = PathBuf::new(); path.push("app");