mirror of
https://github.com/nitnelave/lldap.git
synced 2023-04-12 14:25:13 +00:00
Move the JWTClaims to the model
This commit is contained in:
parent
b49a03fd87
commit
a15d970725
@ -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<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Serialize, Deserialize)]
|
||||
pub struct JWTClaims {
|
||||
pub exp: DateTime<Utc>,
|
||||
pub user: String,
|
||||
pub groups: HashSet<String>,
|
||||
}
|
||||
|
@ -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<S> = jwt::Token<jwt::Header, JWTClaims, S>;
|
||||
type SignedToken = Token<jwt::token::Signed>;
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
struct JWTClaims {
|
||||
exp: DateTime<Utc>,
|
||||
user: String,
|
||||
groups: HashSet<String>,
|
||||
}
|
||||
|
||||
async fn index(req: HttpRequest) -> actix_web::Result<NamedFile> {
|
||||
let mut path = PathBuf::new();
|
||||
path.push("app");
|
||||
|
Loading…
Reference in New Issue
Block a user