diff --git a/README.md b/README.md index cdf13ac2..b42550bc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,6 @@ A curated list of examples related to actix. ## from community -* [RutHub](https://www.ruthub.com/): A service for sharing read list powered by actix-web + diesel, [repo](https://github.com/danloh/rut-server-rust). * [OUISRC](http://ouisrc.xyz/) : Welcome to OUISRC, let us Gain more in exploration and interaction. * [Roseline](https://github.com/DoumanAsh/roseline.rs) : A personal web site and discord & IRC bot to access simple SQLite database. Demonstrates usage of various actix and actix-web concepts. * [Actix Auth Server](https://hgill.io/posts/auth-microservice-rust-actix-web-diesel-complete-tutorial-part-1/) : Auth web micro-service with rust using actix-web - complete tutorial. See code in [examples/simple-auth-server](https://github.com/actix/examples/tree/master/simple-auth-server) diff --git a/cookie-auth/Cargo.toml b/cookie-auth/Cargo.toml index dbc4d11f..12f8cf51 100644 --- a/cookie-auth/Cargo.toml +++ b/cookie-auth/Cargo.toml @@ -7,4 +7,5 @@ workspace = ".." [dependencies] actix-web = "1.0.0" +actix-identity = "0.1.0" env_logger = "0.6" diff --git a/cookie-auth/src/main.rs b/cookie-auth/src/main.rs index f8d9fc0b..8d3b3442 100644 --- a/cookie-auth/src/main.rs +++ b/cookie-auth/src/main.rs @@ -1,5 +1,5 @@ -use actix_web::middleware::identity::Identity; -use actix_web::middleware::identity::{CookieIdentityPolicy, IdentityService}; +use actix_identity::Identity; +use actix_identity::{CookieIdentityPolicy, IdentityService}; use actix_web::{middleware, web, App, HttpResponse, HttpServer}; fn index(id: Identity) -> String { diff --git a/simple-auth-server/Cargo.toml b/simple-auth-server/Cargo.toml index fa2396e1..2edffbb3 100644 --- a/simple-auth-server/Cargo.toml +++ b/simple-auth-server/Cargo.toml @@ -8,8 +8,9 @@ workspace = ".." [dependencies] actix = "0.8.2" actix-rt = "0.2.2" -actix-web = "1.0.0" +actix-web = "1.0.2" actix-files = "0.1.1" +actix-identity= "0.1.0" bcrypt = "0.2.1" chrono = { version = "0.4.6", features = ["serde"] } diff --git a/simple-auth-server/src/auth_handler.rs b/simple-auth-server/src/auth_handler.rs index 444063a6..769bc762 100644 --- a/simple-auth-server/src/auth_handler.rs +++ b/simple-auth-server/src/auth_handler.rs @@ -1,6 +1,6 @@ use actix::{Handler, Message}; -use actix_web::{dev::Payload, Error, HttpRequest}; -use actix_web::{middleware::identity::Identity, FromRequest}; +use actix_web::{dev::Payload, Error, HttpRequest, FromRequest}; +use actix_identity::Identity; use bcrypt::verify; use diesel::prelude::*; diff --git a/simple-auth-server/src/auth_routes.rs b/simple-auth-server/src/auth_routes.rs index 269c3a67..caed66ca 100644 --- a/simple-auth-server/src/auth_routes.rs +++ b/simple-auth-server/src/auth_routes.rs @@ -1,5 +1,5 @@ use actix::Addr; -use actix_web::middleware::identity::Identity; +use actix_identity::Identity; use actix_web::{web, Error, HttpRequest, HttpResponse, Responder, ResponseError}; use futures::Future; diff --git a/simple-auth-server/src/main.rs b/simple-auth-server/src/main.rs index 9fd7c440..45d1ab2d 100644 --- a/simple-auth-server/src/main.rs +++ b/simple-auth-server/src/main.rs @@ -7,10 +7,8 @@ extern crate serde_derive; use actix::prelude::*; use actix_files as fs; -use actix_web::middleware::{ - identity::{CookieIdentityPolicy, IdentityService}, - Logger, -}; +use actix_identity::{CookieIdentityPolicy, IdentityService}; +use actix_web::middleware::Logger; use actix_web::{web, App, HttpServer}; use chrono::Duration; use diesel::{r2d2::ConnectionManager, PgConnection}; diff --git a/web-cors/backend/Cargo.toml b/web-cors/backend/Cargo.toml index 493132eb..6800e5d6 100644 --- a/web-cors/backend/Cargo.toml +++ b/web-cors/backend/Cargo.toml @@ -7,6 +7,7 @@ edition = "2018" [dependencies] actix-web = "1.0.0" +actix-cors = "0.1.0" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" diff --git a/web-cors/backend/src/main.rs b/web-cors/backend/src/main.rs index c009db8e..ed7b71b6 100644 --- a/web-cors/backend/src/main.rs +++ b/web-cors/backend/src/main.rs @@ -1,9 +1,8 @@ #[macro_use] extern crate serde_derive; -use actix_web::{ - http::header, middleware::cors::Cors, middleware::Logger, web, App, HttpServer, -}; +use actix_cors::Cors; +use actix_web::{http::header, middleware::Logger, web, App, HttpServer}; mod user;