New JWT implementation

This commit is contained in:
Adrian Woźniak 2023-08-11 15:26:54 +02:00
parent 6692df9aeb
commit dfb881f2ba

View File

@ -1,4 +1,4 @@
use actix_web::dev::ServiceRequest;
use actix_web::{dev::ServiceRequest, HttpResponse};
use actix_web::HttpMessage;
use jsonwebtoken::{decode, DecodingKey, Validation};
use serde::{de::DeserializeOwned, Serialize};
@ -29,6 +29,10 @@ impl actix_web::ResponseError for Error {
_ => actix_web::http::StatusCode::UNAUTHORIZED,
}
}
fn error_response(&self) -> actix_web::HttpResponse<actix_web::body::BoxBody> {
HttpResponse::build(self.status_code()).body("")
}
}
pub struct Authenticated<T>(Arc<T>);