diff --git a/Cargo.lock b/Cargo.lock index 722a0f2cf3..f83afa3384 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -288,7 +288,7 @@ dependencies = [ [[package]] name = "auth-common" version = "0.1.0" -source = "git+https://gitlab.com/veloren/auth.git?rev=fb3dcbc4962b367253f8f2f92760ef44d2679c9a#fb3dcbc4962b367253f8f2f92760ef44d2679c9a" +source = "git+https://gitlab.com/veloren/auth.git?rev=9d3df28de3bc9a34321b3c99789a9add652cb2ba#9d3df28de3bc9a34321b3c99789a9add652cb2ba" dependencies = [ "rand 0.8.4", "serde", @@ -298,17 +298,16 @@ dependencies = [ [[package]] name = "authc" version = "1.0.0" -source = "git+https://gitlab.com/veloren/auth.git?rev=fb3dcbc4962b367253f8f2f92760ef44d2679c9a#fb3dcbc4962b367253f8f2f92760ef44d2679c9a" +source = "git+https://gitlab.com/veloren/auth.git?rev=9d3df28de3bc9a34321b3c99789a9add652cb2ba#9d3df28de3bc9a34321b3c99789a9add652cb2ba" dependencies = [ "auth-common", "fxhash", "hex", - "http", - "hyper", - "hyper-rustls", + "reqwest", "rust-argon2", "serde", "serde_json", + "url", "uuid", ] @@ -1321,6 +1320,12 @@ dependencies = [ "syn 1.0.73", ] +[[package]] +name = "data-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ee2393c4a91429dffb4bedf19f4d6abf27d8a732c8ce4980305d782e5426d57" + [[package]] name = "deflate" version = "0.8.6" @@ -1498,6 +1503,18 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c34f04666d835ff5d62e058c3995147c06f42fe86ff053337632bca83e42702d" +[[package]] +name = "enum-as-inner" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c5f0096a91d210159eceb2ff5e1c4da18388a170e1e3ce948aac9c8fdbbf595" +dependencies = [ + "heck", + "proc-macro2 1.0.27", + "quote 1.0.9", + "syn 1.0.73", +] + [[package]] name = "enum-iterator" version = "0.6.0" @@ -2370,9 +2387,9 @@ dependencies = [ [[package]] name = "hex" -version = "0.3.2" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "805026a5d0141ffc30abb3be3173848ad46a1b1664fe632428479619a3644d77" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hibitset" @@ -2384,6 +2401,17 @@ dependencies = [ "rayon", ] +[[package]] +name = "hostname" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c731c3e10504cc8ed35cfe2f1db4c9274c3d35fa486e3b31df46f068ef3e867" +dependencies = [ + "libc", + "match_cfg", + "winapi 0.3.9", +] + [[package]] name = "http" version = "0.2.4" @@ -2454,12 +2482,10 @@ version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f9f7a97316d44c0af9b0301e65010573a853a9fc97046d7331d7f6bc0fd5a64" dependencies = [ - "ct-logs", "futures-util", "hyper", "log", "rustls", - "rustls-native-certs", "tokio", "tokio-rustls", "webpki", @@ -2637,6 +2663,24 @@ dependencies = [ "libc", ] +[[package]] +name = "ipconfig" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7e2f18aece9709094573a9f24f483c4f65caa4298e2f7ae1b71cc65d853fad7" +dependencies = [ + "socket2 0.3.19", + "widestring", + "winapi 0.3.9", + "winreg 0.6.2", +] + +[[package]] +name = "ipnet" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68f2d64f2edebec4ce84ad108148e67e1064789bee435edc5b60ad398714a3a9" + [[package]] name = "itertools" version = "0.9.0" @@ -2920,6 +2964,15 @@ dependencies = [ "syn 1.0.73", ] +[[package]] +name = "lru-cache" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "31e24f1ad8321ca0e8a1e0ac13f23cb668e6f5466c2c57319f6a5cf1cc8e3b1c" +dependencies = [ + "linked-hash-map", +] + [[package]] name = "lz-fear" version = "0.1.1" @@ -2960,6 +3013,12 @@ dependencies = [ "libc", ] +[[package]] +name = "match_cfg" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffbee8634e0d45d258acb448e7eaab3fce7a0a467395d4d9f228e3c1f01fb2e4" + [[package]] name = "matchers" version = "0.0.1" @@ -3047,6 +3106,12 @@ dependencies = [ "objc", ] +[[package]] +name = "mime" +version = "0.3.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" + [[package]] name = "minifb" version = "0.19.3" @@ -4047,6 +4112,12 @@ dependencies = [ "syn 1.0.73", ] +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + [[package]] name = "quinn" version = "0.7.2" @@ -4401,6 +4472,53 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f1382d1f0a252c4bf97dc20d979a2fdd05b024acd7c2ed0f7595d7817666a157" +[[package]] +name = "reqwest" +version = "0.11.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246e9f61b9bb77df069a947682be06e31ac43ea37862e244a69f177694ea6d22" +dependencies = [ + "base64", + "bytes", + "encoding_rs", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "hyper-rustls", + "ipnet", + "js-sys", + "lazy_static", + "log", + "mime", + "percent-encoding", + "pin-project-lite", + "rustls", + "serde", + "serde_json", + "serde_urlencoded", + "tokio", + "tokio-rustls", + "trust-dns-resolver", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", + "winreg 0.7.0", +] + +[[package]] +name = "resolv-conf" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52e44394d2086d010551b14b53b1f24e31647570cd1deb0379e2c21b329aba00" +dependencies = [ + "hostname", + "quick-error", +] + [[package]] name = "ring" version = "0.16.20" @@ -4831,6 +4949,18 @@ dependencies = [ "syn 1.0.73", ] +[[package]] +name = "serde_urlencoded" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edfa57a7f8d9c1d260a549e7224100f6c43d43f9103e06dd8b4095a9b2b43ce9" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + [[package]] name = "sha1" version = "0.6.0" @@ -5641,6 +5771,51 @@ dependencies = [ "vek", ] +[[package]] +name = "trust-dns-proto" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0d7f5db438199a6e2609debe3f69f808d074e0a2888ee0bccb45fe234d03f4" +dependencies = [ + "async-trait", + "cfg-if 1.0.0", + "data-encoding", + "enum-as-inner", + "futures-channel", + "futures-io", + "futures-util", + "idna", + "ipnet", + "lazy_static", + "log", + "rand 0.8.4", + "smallvec", + "thiserror", + "tinyvec", + "tokio", + "url", +] + +[[package]] +name = "trust-dns-resolver" +version = "0.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ad17b608a64bd0735e67bde16b0636f8aa8591f831a25d18443ed00a699770" +dependencies = [ + "cfg-if 1.0.0", + "futures-util", + "ipconfig", + "lazy_static", + "log", + "lru-cache", + "parking_lot 0.11.1", + "resolv-conf", + "smallvec", + "thiserror", + "tokio", + "trust-dns-proto", +] + [[package]] name = "try-lock" version = "0.2.3" @@ -6385,6 +6560,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d54ee1d4ed486f78874278e63e4069fc1ab9f6a18ca492076ffb90c5eb2997fd" dependencies = [ "cfg-if 1.0.0", + "serde", + "serde_json", "wasm-bindgen-macro", ] @@ -6744,6 +6921,15 @@ dependencies = [ "untrusted", ] +[[package]] +name = "webpki-roots" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940" +dependencies = [ + "webpki", +] + [[package]] name = "wfd" version = "0.1.7" @@ -6842,6 +7028,12 @@ dependencies = [ "libc", ] +[[package]] +name = "widestring" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c168940144dd21fd8046987c16a46a33d5fc84eec29ef9dcddc2ac9e31526b7c" + [[package]] name = "winapi" version = "0.2.8" @@ -6940,6 +7132,24 @@ dependencies = [ "x11-dl", ] +[[package]] +name = "winreg" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2986deb581c4fe11b621998a5e53361efe6b48a151178d0cd9eeffa4dc6acc9" +dependencies = [ + "winapi 0.3.9", +] + +[[package]] +name = "winreg" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0120db82e8a1e0b9fb3345a539c478767c0048d842860994d96113d5b667bd69" +dependencies = [ + "winapi 0.3.9", +] + [[package]] name = "winres" version = "0.1.11" diff --git a/client/Cargo.toml b/client/Cargo.toml index c43090cecc..d4823177d5 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -30,7 +30,7 @@ rayon = "1.5" specs = { git = "https://github.com/amethyst/specs.git", rev = "f985bec5d456f7b0dd8aae99848f9473c2cd9d46" } vek = { version = "=0.14.1", features = ["serde"] } hashbrown = { version = "0.11", features = ["rayon", "serde", "nightly"] } -authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253f8f2f92760ef44d2679c9a" } +authc = { git = "https://gitlab.com/veloren/auth.git", rev = "9d3df28de3bc9a34321b3c99789a9add652cb2ba" } #TODO: put bot in a different crate #bot only diff --git a/client/src/bin/bot/main.rs b/client/src/bin/bot/main.rs index d4362b9b12..95b62d88cc 100644 --- a/client/src/bin/bot/main.rs +++ b/client/src/bin/bot/main.rs @@ -108,12 +108,6 @@ impl BotClient { info!("usernames: {:?}", usernames); if let Some(auth_addr) = self.menu_client.server_info().auth_provider.as_ref() { let (scheme, authority) = auth_addr.split_once("://").expect("invalid auth url"); - let scheme = scheme - .parse::() - .expect("invalid auth url scheme"); - let authority = authority - .parse::() - .expect("invalid auth url authority"); let authc = AuthClient::new(scheme, authority).expect("couldn't connect to , insecure"); for username in usernames.iter() { diff --git a/client/src/lib.rs b/client/src/lib.rs index 018ca47a64..a292960d90 100644 --- a/client/src/lib.rs +++ b/client/src/lib.rs @@ -670,16 +670,6 @@ impl Client { None => return Err(Error::AuthServerUrlInvalid(addr.to_string())), }; - let scheme = match scheme.parse::() { - Ok(s) => s, - Err(_) => return Err(Error::AuthServerUrlInvalid(addr.to_string())), - }; - - let authority = match authority.parse::() { - Ok(a) => a, - Err(_) => return Err(Error::AuthServerUrlInvalid(addr.to_string())), - }; - Ok(authc::AuthClient::new(scheme, authority)? .sign_in(&username, &password) .await? diff --git a/server/Cargo.toml b/server/Cargo.toml index d43a6a0aee..124ab8155a 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -47,7 +47,7 @@ rayon = "1.5" crossbeam-channel = "0.5" prometheus = { version = "0.12", default-features = false} portpicker = { git = "https://github.com/xMAC94x/portpicker-rs", rev = "df6b37872f3586ac3b21d08b56c8ec7cd92fb172" } -authc = { git = "https://gitlab.com/veloren/auth.git", rev = "fb3dcbc4962b367253f8f2f92760ef44d2679c9a" } +authc = { git = "https://gitlab.com/veloren/auth.git", rev = "9d3df28de3bc9a34321b3c99789a9add652cb2ba" } slab = "0.4" rand_distr = "0.4.0" diff --git a/server/src/login_provider.rs b/server/src/login_provider.rs index 0fd7db307e..80501816eb 100644 --- a/server/src/login_provider.rs +++ b/server/src/login_provider.rs @@ -59,13 +59,6 @@ impl LoginProvider { let auth_server = auth_addr.map(|addr| { let (scheme, authority) = addr.split_once("://").expect("invalid auth url"); - let scheme = scheme - .parse::() - .expect("invalid auth url scheme"); - let authority = authority - .parse::() - .expect("invalid auth url authority"); - Arc::new(AuthClient::new(scheme, authority).expect("insecure auth scheme")) }); diff --git a/voxygen/src/menu/main/mod.rs b/voxygen/src/menu/main/mod.rs index 5914cd5f1f..f9f83f9b80 100644 --- a/voxygen/src/menu/main/mod.rs +++ b/voxygen/src/menu/main/mod.rs @@ -429,11 +429,16 @@ fn get_client_msg_error( client::AuthClientError::InsecureSchema => { localization.get("main.login.insecure_auth_scheme").into() }, + client::AuthClientError::InvalidUrl(e) => format!( + "{}: {}", + localization.get("main.login.failed_auth_server_url_invalid"), + e + ), client::AuthClientError::ServerError(_, e) => String::from_utf8_lossy(&e).into(), }, Error::AuthServerUrlInvalid(e) => { format!( - "{}: https://{}", + "{}: {}", localization.get("main.login.failed_auth_server_url_invalid"), e )