Skip to content

Commit 6f12db1

Browse files
authored
Merge pull request #22 from SakaDream:update-dependencies
Update Dependencies
2 parents 2e84afa + d9591f1 commit 6f12db1

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@ authors = ["SakaDream <bahaimt@gmail.com>"]
55
edition = "2018"
66

77
[dependencies]
8-
actix-web = "2.0.0"
8+
actix-web = "3.0.0"
99
actix-rt = "1.1.1"
1010
actix-service = "1.0.6"
11-
actix-cors = "0.2.0"
11+
actix-cors = "0.3.0"
1212
log = "0.4.11"
1313
env_logger = "0.7.1"
1414
diesel_migrations = "1.4.0"
15-
serde = "1.0.115"
16-
serde_derive = "1.0.115"
15+
serde = "1.0.116"
16+
serde_derive = "1.0.116"
1717
serde_json = "1.0.57"
1818
dotenv = "0.15.0"
1919
futures = "0.3.5"
2020
failure = "0.1.8"
21-
derive_more = "0.99.9"
21+
derive_more = "0.99.10"
2222
jsonwebtoken = "7.2.0"
2323
bcrypt = "0.8.2"
2424

src/middleware/authen_middleware.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
use crate::{config::db::Pool, constants, models::response::ResponseBody, utils::token_utils};
22
use actix_service::{Service, Transform};
33
use actix_web::{
4-
http::{Method},
5-
dev::{ServiceRequest, ServiceResponse},
64
Error, HttpResponse,
5+
dev::{ServiceRequest, ServiceResponse},
6+
http::{Method, HeaderName, HeaderValue},
7+
web::Data,
78
};
89
use futures::{
910
future::{ok, Ready},
@@ -13,7 +14,6 @@ use std::{
1314
pin::Pin,
1415
task::{Context, Poll},
1516
};
16-
use actix_web::http::header::{HeaderName, HeaderValue};
1717

1818
pub struct Authentication;
1919

@@ -68,17 +68,17 @@ where
6868
}
6969
}
7070
if !authenticate_pass {
71-
if let Some(pool) = req.app_data::<Pool>() {
71+
if let Some(pool) = req.app_data::<Data<Pool>>() {
7272
info!("Connecting to database...");
73-
if let Some(authen_header) = req.headers_mut().get(constants::AUTHORIZATION) {
73+
if let Some(authen_header) = req.headers().get(constants::AUTHORIZATION) {
7474
info!("Parsing authorization header...");
7575
if let Ok(authen_str) = authen_header.to_str() {
7676
if authen_str.starts_with("bearer") || authen_str.starts_with("Bearer") {
7777
info!("Parsing token...");
7878
let token = authen_str[6..authen_str.len()].trim();
7979
if let Ok(token_data) = token_utils::decode_token(token.to_string()) {
8080
info!("Decoding token...");
81-
if token_utils::verify_token(&token_data, &pool).is_ok() {
81+
if token_utils::verify_token(&token_data, pool).is_ok() {
8282
info!("Valid token");
8383
authenticate_pass = true;
8484
} else {

0 commit comments

Comments
 (0)