From 425063e24e6e41ef20507349e31eea69cd574d8d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcel=20M=C3=A4rtens?= Date: Tue, 6 Apr 2021 22:22:14 +0200 Subject: [PATCH] remove authc from common::net --- Cargo.lock | 1 - common/net/Cargo.toml | 3 --- common/net/src/msg/server.rs | 5 ----- server/src/login_provider.rs | 14 +++++++++++--- 4 files changed, 11 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2553e70952..b27aa7160e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5524,7 +5524,6 @@ dependencies = [ name = "veloren-common-net" version = "0.9.0" dependencies = [ - "authc", "hashbrown", "serde", "specs", diff --git a/common/net/Cargo.toml b/common/net/Cargo.toml index 083afece47..209c2d6a18 100644 --- a/common/net/Cargo.toml +++ b/common/net/Cargo.toml @@ -21,9 +21,6 @@ tracing = { version = "0.1", default-features = false } # Data structures hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] } -# Auth -authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253f8f2f92760ef44d2679c9a" } - # ECS specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control"], rev = "5a9b71035007be0e3574f35184acac1cd4530496" } specs-idvs = { git = "https://gitlab.com/veloren/specs-idvs.git", rev = "b65fb220e94f5d3c9bc30074a076149763795556" } diff --git a/common/net/src/msg/server.rs b/common/net/src/msg/server.rs index b16a10dbfa..9eabad35ca 100644 --- a/common/net/src/msg/server.rs +++ b/common/net/src/msg/server.rs @@ -1,6 +1,5 @@ use super::{world_msg::EconomyInfo, ClientType, EcsCompPacket, PingMsg}; use crate::sync; -use authc::AuthClientError; use common::{ character::{self, CharacterItem}, comp::{self, invite::InviteKind, item::MaterialStatManifest}, @@ -259,10 +258,6 @@ impl ServerMsg { } } -impl From for RegisterError { - fn from(err: AuthClientError) -> Self { Self::AuthError(err.to_string()) } -} - impl From for ServerGeneral { fn from(v: comp::ChatMsg) -> Self { ServerGeneral::ChatMsg(v) } } diff --git a/server/src/login_provider.rs b/server/src/login_provider.rs index 2028bc545a..b0b149b76d 100644 --- a/server/src/login_provider.rs +++ b/server/src/login_provider.rs @@ -167,9 +167,17 @@ impl LoginProvider { let token = AuthToken::from_str(username_or_token) .map_err(|e| RegisterError::AuthError(e.to_string()))?; // Validate token - let uuid = srv.validate(token).await?; - let username = srv.uuid_to_username(uuid).await?; - Ok((username, uuid)) + match async { + let uuid = srv.validate(token).await?; + let username = srv.uuid_to_username(uuid).await?; + let r: Result<_, authc::AuthClientError> = Ok((username, uuid)); + r + } + .await + { + Err(e) => Err(RegisterError::AuthError(e.to_string())), + Ok((username, uuid)) => Ok((username, uuid)), + } } pub fn username_to_uuid(&self, username: &str) -> Result {