Update rauth, pin git repositories in Cargo.toml.

This commit is contained in:
Paul Makles
2021-01-25 21:35:47 +00:00
parent 99e2f874a1
commit 75a35831da
5 changed files with 266 additions and 186 deletions

View File

@@ -29,7 +29,7 @@ impl<'a, 'r> FromRequest<'a, 'r> for User {
} else {
Outcome::Failure((
Status::InternalServerError,
rauth::util::Error::DatabaseError,
rauth::util::Error::DatabaseError { operation: "find_one", with: "user" },
))
}
}

View File

@@ -20,7 +20,7 @@ pub mod util;
use futures::join;
use log::info;
use rauth;
use rauth::{self, options::Options};
use rocket_cors::AllowedOrigins;
#[async_std::main]
@@ -55,10 +55,12 @@ async fn launch_web() {
.to_cors()
.expect("Failed to create CORS.");
let auth = rauth::auth::Auth::new(database::get_collection("accounts"));
let auth = rauth::auth::Auth::new(database::get_collection("accounts"), Options::new());
routes::mount(rauth::routes::mount(rocket::ignite(), "/auth", auth))
routes::mount(rocket::ignite())
.mount("/", rocket_cors::catch_all_options_routes())
.mount("/auth", rauth::routes::routes())
.manage(auth)
.manage(cors.clone())
.attach(cors)
.launch()

View File

@@ -12,7 +12,7 @@ use futures::{pin_mut, prelude::*};
use hive_pubsub::PubSub;
use log::{debug, info};
use many_to_many::ManyToMany;
use rauth::auth::{Auth, Session};
use rauth::{auth::{Auth, Session}, options::Options};
use std::collections::HashMap;
use std::net::SocketAddr;
use std::sync::{Arc, Mutex, RwLock};
@@ -84,7 +84,7 @@ async fn accept(stream: TcpStream) {
}
}
if let Ok(validated_session) = Auth::new(get_collection("accounts"))
if let Ok(validated_session) = Auth::new(get_collection("accounts"), Options::new())
.verify_session(new_session)
.await
{