mirror of
https://github.com/Astatin3/unshell.git
synced 2026-06-09 06:47:59 -06:00
JWT Authentication
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
#![macro_use]
|
||||
|
||||
use chrono::Duration;
|
||||
use jsonwebtoken::{DecodingKey, EncodingKey};
|
||||
use static_init::dynamic;
|
||||
extern crate unshell_lib;
|
||||
|
||||
pub mod app;
|
||||
mod auth;
|
||||
mod structs;
|
||||
mod userdata;
|
||||
|
||||
static EXPIRE_DURATION: Duration = Duration::seconds(10);
|
||||
|
||||
#[dynamic]
|
||||
static JWT_SECRET: String = std::env::var("JWT_SECRET").expect("JWT_SECRET must be set");
|
||||
|
||||
#[dynamic]
|
||||
static JWT_ENCODING_KEY: EncodingKey = EncodingKey::from_secret(JWT_SECRET.as_bytes());
|
||||
#[dynamic]
|
||||
static JWT_DECODING_KEY: DecodingKey = DecodingKey::from_secret(JWT_SECRET.as_bytes());
|
||||
Reference in New Issue
Block a user