update authc

This commit is contained in:
Acrimon 2020-12-28 16:17:43 +01:00
parent 2e13806d1a
commit e76474463a
No known key found for this signature in database
GPG Key ID: FE567F46AFBDF3AE
6 changed files with 272 additions and 39 deletions

301
Cargo.lock generated
View File

@ -314,7 +314,7 @@ dependencies = [
[[package]] [[package]]
name = "auth-common" name = "auth-common"
version = "0.1.0" version = "0.1.0"
source = "git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c73097640162bfe#b943c85e4a38f5ec60cd18c34c73097640162bfe" source = "git+https://gitlab.com/veloren/auth.git?rev=bffb5181a35c19ddfd33ee0b4aedba741aafb68d#bffb5181a35c19ddfd33ee0b4aedba741aafb68d"
dependencies = [ dependencies = [
"rand 0.7.3", "rand 0.7.3",
"serde", "serde",
@ -324,14 +324,15 @@ dependencies = [
[[package]] [[package]]
name = "authc" name = "authc"
version = "1.0.0" version = "1.0.0"
source = "git+https://gitlab.com/veloren/auth.git?rev=b943c85e4a38f5ec60cd18c34c73097640162bfe#b943c85e4a38f5ec60cd18c34c73097640162bfe" source = "git+https://gitlab.com/veloren/auth.git?rev=bffb5181a35c19ddfd33ee0b4aedba741aafb68d#bffb5181a35c19ddfd33ee0b4aedba741aafb68d"
dependencies = [ dependencies = [
"auth-common", "auth-common",
"fxhash", "fxhash",
"hex 0.3.2", "hex 0.3.2",
"reqwest",
"rust-argon2", "rust-argon2",
"serde_json", "serde",
"ureq 1.4.1", "url 2.1.1",
"uuid", "uuid",
] ]
@ -1613,12 +1614,27 @@ dependencies = [
"bitflags", "bitflags",
] ]
[[package]]
name = "dtoa"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "88d7ed2934d741c6b37e33e3832298e8850b53fd2d2bea03873375596c7cea4e"
[[package]] [[package]]
name = "either" name = "either"
version = "1.6.1" version = "1.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457" checksum = "e78d4f1cc4ae33bbfc157ed5d5a5ef3bc29227303d595861deb238fcec4e9457"
[[package]]
name = "encoding_rs"
version = "0.8.26"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "801bbab217d7f79c0062f4f7205b5d4427c6d1a7bd7aafdd1475f7c59d62b283"
dependencies = [
"cfg-if 1.0.0",
]
[[package]] [[package]]
name = "enum-iterator" name = "enum-iterator"
version = "0.6.0" version = "0.6.0"
@ -1725,7 +1741,7 @@ checksum = "b5c55005e95bbe15f5f72a73b6597d0dc82ddc97ffe2ca097a99dcd591fefbca"
dependencies = [ dependencies = [
"libflate", "libflate",
"tar", "tar",
"ureq 0.11.4", "ureq",
] ]
[[package]] [[package]]
@ -2301,7 +2317,7 @@ dependencies = [
"bytes 0.4.12", "bytes 0.4.12",
"fnv", "fnv",
"futures 0.1.29", "futures 0.1.29",
"http", "http 0.1.21",
"indexmap", "indexmap",
"log", "log",
"slab", "slab",
@ -2309,6 +2325,26 @@ dependencies = [
"tokio-io", "tokio-io",
] ]
[[package]]
name = "h2"
version = "0.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5e4728fd124914ad25e99e3d15a9361a879f6620f63cb56bbb08f95abb97a535"
dependencies = [
"bytes 0.5.6",
"fnv",
"futures-core",
"futures-sink",
"futures-util",
"http 0.2.2",
"indexmap",
"slab",
"tokio 0.2.24",
"tokio-util",
"tracing",
"tracing-futures",
]
[[package]] [[package]]
name = "half" name = "half"
version = "1.6.0" version = "1.6.0"
@ -2420,6 +2456,17 @@ dependencies = [
"itoa", "itoa",
] ]
[[package]]
name = "http"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "84129d298a6d57d246960ff8eb831ca4af3f96d29e2e28848dae275408658e26"
dependencies = [
"bytes 0.5.6",
"fnv",
"itoa",
]
[[package]] [[package]]
name = "http-body" name = "http-body"
version = "0.1.0" version = "0.1.0"
@ -2428,10 +2475,20 @@ checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d"
dependencies = [ dependencies = [
"bytes 0.4.12", "bytes 0.4.12",
"futures 0.1.29", "futures 0.1.29",
"http", "http 0.1.21",
"tokio-buf", "tokio-buf",
] ]
[[package]]
name = "http-body"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "13d5ff830006f7646652e057693569bfe0d51760c0085a071769d142a205111b"
dependencies = [
"bytes 0.5.6",
"http 0.2.2",
]
[[package]] [[package]]
name = "http-service" name = "http-service"
version = "0.4.0" version = "0.4.0"
@ -2441,7 +2498,7 @@ dependencies = [
"async-std", "async-std",
"bytes 0.4.12", "bytes 0.4.12",
"futures 0.3.5", "futures 0.3.5",
"http", "http 0.1.21",
"pin-project-lite", "pin-project-lite",
] ]
@ -2452,9 +2509,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e33d5dae94e0fdb82f9524ea2f2b98458b3d8448526d8cc8beccb3d3fded8aff" checksum = "e33d5dae94e0fdb82f9524ea2f2b98458b3d8448526d8cc8beccb3d3fded8aff"
dependencies = [ dependencies = [
"futures 0.3.5", "futures 0.3.5",
"http", "http 0.1.21",
"http-service", "http-service",
"hyper", "hyper 0.12.35",
] ]
[[package]] [[package]]
@ -2463,6 +2520,12 @@ version = "1.3.4"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9"
[[package]]
name = "httpdate"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47"
[[package]] [[package]]
name = "hyper" name = "hyper"
version = "0.12.35" version = "0.12.35"
@ -2472,9 +2535,9 @@ dependencies = [
"bytes 0.4.12", "bytes 0.4.12",
"futures 0.1.29", "futures 0.1.29",
"futures-cpupool", "futures-cpupool",
"h2", "h2 0.1.26",
"http", "http 0.1.21",
"http-body", "http-body 0.1.0",
"httparse", "httparse",
"iovec", "iovec",
"itoa", "itoa",
@ -2482,7 +2545,7 @@ dependencies = [
"net2", "net2",
"rustc_version", "rustc_version",
"time", "time",
"tokio", "tokio 0.1.22",
"tokio-buf", "tokio-buf",
"tokio-executor", "tokio-executor",
"tokio-io", "tokio-io",
@ -2490,7 +2553,47 @@ dependencies = [
"tokio-tcp", "tokio-tcp",
"tokio-threadpool", "tokio-threadpool",
"tokio-timer", "tokio-timer",
"want", "want 0.2.0",
]
[[package]]
name = "hyper"
version = "0.13.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f6ad767baac13b44d4529fcf58ba2cd0995e36e7b435bc5b039de6f47e880dbf"
dependencies = [
"bytes 0.5.6",
"futures-channel",
"futures-core",
"futures-util",
"h2 0.2.7",
"http 0.2.2",
"http-body 0.3.1",
"httparse",
"httpdate",
"itoa",
"pin-project 1.0.2",
"socket2",
"tokio 0.2.24",
"tower-service",
"tracing",
"want 0.3.0",
]
[[package]]
name = "hyper-rustls"
version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "37743cc83e8ee85eacfce90f2f4102030d9ff0a95244098d781e9bee4a90abb6"
dependencies = [
"bytes 0.5.6",
"futures-util",
"hyper 0.13.9",
"log",
"rustls 0.18.1",
"tokio 0.2.24",
"tokio-rustls",
"webpki",
] ]
[[package]] [[package]]
@ -2678,6 +2781,12 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "ipnet"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47be2f14c678be2fdcab04ab1171db51b2762ce6f0a8ee87c8dd4a04ed216135"
[[package]] [[package]]
name = "itertools" name = "itertools"
version = "0.9.0" version = "0.9.0"
@ -3059,6 +3168,16 @@ version = "0.3.16"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d"
[[package]]
name = "mime_guess"
version = "2.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2684d4c2e97d99848d30b324b00c8fcc7e5c897b7cbb5819b09e7c90e8baf212"
dependencies = [
"mime",
"unicase",
]
[[package]] [[package]]
name = "minifb" name = "minifb"
version = "0.19.1" version = "0.19.1"
@ -4360,6 +4479,43 @@ dependencies = [
"winapi 0.3.9", "winapi 0.3.9",
] ]
[[package]]
name = "reqwest"
version = "0.10.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e9eaa17ac5d7b838b7503d118fa16ad88f440498bf9ffe5424e621f93190d61e"
dependencies = [
"base64 0.12.3",
"bytes 0.5.6",
"encoding_rs",
"futures-core",
"futures-util",
"http 0.2.2",
"http-body 0.3.1",
"hyper 0.13.9",
"hyper-rustls",
"ipnet",
"js-sys",
"lazy_static",
"log",
"mime",
"mime_guess",
"percent-encoding 2.1.0",
"pin-project-lite",
"rustls 0.18.1",
"serde",
"serde_json",
"serde_urlencoded",
"tokio 0.2.24",
"tokio-rustls",
"url 2.1.1",
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
"webpki-roots 0.19.0",
"winreg",
]
[[package]] [[package]]
name = "ring" name = "ring"
version = "0.16.15" version = "0.16.15"
@ -4687,6 +4843,18 @@ dependencies = [
"syn 1.0.54", "syn 1.0.54",
] ]
[[package]]
name = "serde_urlencoded"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9ec5d77e2d4c73717816afac02670d5c4f534ea95ed430442cad02e7a6e32c97"
dependencies = [
"dtoa",
"itoa",
"serde",
"url 2.1.1",
]
[[package]] [[package]]
name = "sha1" name = "sha1"
version = "0.6.0" version = "0.6.0"
@ -5199,7 +5367,7 @@ dependencies = [
"async-std", "async-std",
"cookie", "cookie",
"futures 0.3.5", "futures 0.3.5",
"http", "http 0.1.21",
"http-service", "http-service",
"http-service-hyper", "http-service-hyper",
"log", "log",
@ -5269,6 +5437,24 @@ dependencies = [
"tokio-timer", "tokio-timer",
] ]
[[package]]
name = "tokio"
version = "0.2.24"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "099837d3464c16a808060bb3f02263b412f6fafcb5d01c533d309985fbeebe48"
dependencies = [
"bytes 0.5.6",
"fnv",
"futures-core",
"iovec",
"lazy_static",
"memchr",
"mio 0.6.22",
"num_cpus",
"pin-project-lite",
"slab",
]
[[package]] [[package]]
name = "tokio-buf" name = "tokio-buf"
version = "0.1.1" version = "0.1.1"
@ -5330,6 +5516,18 @@ dependencies = [
"tokio-sync", "tokio-sync",
] ]
[[package]]
name = "tokio-rustls"
version = "0.14.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e12831b255bcfa39dc0436b01e19fea231a37db570686c06ee72c423479f889a"
dependencies = [
"futures-core",
"rustls 0.18.1",
"tokio 0.2.24",
"webpki",
]
[[package]] [[package]]
name = "tokio-sync" name = "tokio-sync"
version = "0.1.8" version = "0.1.8"
@ -5383,6 +5581,20 @@ dependencies = [
"tokio-executor", "tokio-executor",
] ]
[[package]]
name = "tokio-util"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "be8242891f2b6cbef26a2d7e8605133c2c554cd35b3e4948ea892d6d68436499"
dependencies = [
"bytes 0.5.6",
"futures-core",
"futures-sink",
"log",
"pin-project-lite",
"tokio 0.2.24",
]
[[package]] [[package]]
name = "toml" name = "toml"
version = "0.5.7" version = "0.5.7"
@ -5392,6 +5604,12 @@ dependencies = [
"serde", "serde",
] ]
[[package]]
name = "tower-service"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e987b6bf443f4b5b3b6f38704195592cca41c5bb7aedd3c3693c7081f8289860"
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.21" version = "0.1.21"
@ -5399,6 +5617,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27" checksum = "b0987850db3733619253fe60e17cb59b82d37c7e6c0236bb81e4d6b87c879f27"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 0.1.10",
"log",
"pin-project-lite", "pin-project-lite",
"tracing-attributes", "tracing-attributes",
"tracing-core", "tracing-core",
@ -5573,6 +5792,15 @@ version = "1.12.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33" checksum = "373c8a200f9e67a0c95e62a4f52fbf80c23b4381c05a17845531982fa99e6b33"
[[package]]
name = "unicase"
version = "2.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50f37be617794602aabbeee0be4f259dc1778fabe05e2d67ee8f79326d5cb4f6"
dependencies = [
"version_check 0.9.2",
]
[[package]] [[package]]
name = "unicode-bidi" name = "unicode-bidi"
version = "0.3.4" version = "0.3.4"
@ -5647,22 +5875,6 @@ dependencies = [
"webpki-roots 0.18.0", "webpki-roots 0.18.0",
] ]
[[package]]
name = "ureq"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c7fb6c9aba13a511bcbb7770864c0e9b8392acda0454a71104498a2bb112d701"
dependencies = [
"base64 0.12.3",
"chunked_transfer",
"lazy_static",
"qstring",
"rustls 0.18.1",
"url 2.1.1",
"webpki",
"webpki-roots 0.20.0",
]
[[package]] [[package]]
name = "url" name = "url"
version = "1.7.2" version = "1.7.2"
@ -6129,6 +6341,16 @@ dependencies = [
"try-lock", "try-lock",
] ]
[[package]]
name = "want"
version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0"
dependencies = [
"log",
"try-lock",
]
[[package]] [[package]]
name = "wasi" name = "wasi"
version = "0.9.0+wasi-snapshot-preview1" version = "0.9.0+wasi-snapshot-preview1"
@ -6148,6 +6370,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42" checksum = "1ac64ead5ea5f05873d7c12b545865ca2b8d28adfc50a49b84770a3a97265d42"
dependencies = [ dependencies = [
"cfg-if 0.1.10", "cfg-if 0.1.10",
"serde",
"serde_json",
"wasm-bindgen-macro", "wasm-bindgen-macro",
] ]
@ -6507,9 +6731,9 @@ dependencies = [
[[package]] [[package]]
name = "webpki-roots" name = "webpki-roots"
version = "0.20.0" version = "0.19.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0f20dea7535251981a9670857150d571846545088359b28e4951d350bdaf179f" checksum = "f8eff4b7516a57307f9349c64bf34caa34b940b66fed4b2fb3136cb7386e5739"
dependencies = [ dependencies = [
"webpki", "webpki",
] ]
@ -6621,6 +6845,15 @@ dependencies = [
"x11-dl", "x11-dl",
] ]
[[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]] [[package]]
name = "winres" name = "winres"
version = "0.1.11" version = "0.1.11"

View File

@ -29,7 +29,7 @@ rayon = "1.5"
specs = { git = "https://github.com/amethyst/specs.git", rev = "d4435bdf496cf322c74886ca09dd8795984919b4" } specs = { git = "https://github.com/amethyst/specs.git", rev = "d4435bdf496cf322c74886ca09dd8795984919b4" }
vek = { version = "0.12.0", features = ["serde"] } vek = { version = "0.12.0", features = ["serde"] }
hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] }
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" } authc = { git = "https://gitlab.com/veloren/auth.git", rev = "bffb5181a35c19ddfd33ee0b4aedba741aafb68d" }
[dev-dependencies] [dev-dependencies]
tracing-subscriber = { version = "0.2.3", default-features = false, features = ["fmt", "chrono", "ansi", "smallvec"] } tracing-subscriber = { version = "0.2.3", default-features = false, features = ["fmt", "chrono", "ansi", "smallvec"] }

View File

@ -461,7 +461,7 @@ impl Client {
let token_or_username = self.server_info.auth_provider.as_ref().map(|addr| let token_or_username = self.server_info.auth_provider.as_ref().map(|addr|
// Query whether this is a trusted auth server // Query whether this is a trusted auth server
if auth_trusted(&addr) { if auth_trusted(&addr) {
Ok(authc::AuthClient::new(addr) Ok(authc::AuthClient::new(addr)?
.sign_in(&username, &password)? .sign_in(&username, &password)?
.serialize()) .serialize())
} else { } else {

View File

@ -21,7 +21,7 @@ tracing = { version = "0.1", default-features = false }
hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] } hashbrown = { version = "0.9", features = ["rayon", "serde", "nightly"] }
# Auth # Auth
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" } authc = { git = "https://gitlab.com/veloren/auth.git", rev = "bffb5181a35c19ddfd33ee0b4aedba741aafb68d" }
# ECS # ECS
specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control"], rev = "d4435bdf496cf322c74886ca09dd8795984919b4" } specs = { git = "https://github.com/amethyst/specs.git", features = ["serde", "storage-event-control"], rev = "d4435bdf496cf322c74886ca09dd8795984919b4" }

View File

@ -41,7 +41,7 @@ crossbeam-channel = "0.5"
prometheus = { version = "0.11", default-features = false} prometheus = { version = "0.11", default-features = false}
tiny_http = "0.7.0" tiny_http = "0.7.0"
portpicker = { git = "https://github.com/xMAC94x/portpicker-rs" } portpicker = { git = "https://github.com/xMAC94x/portpicker-rs" }
authc = { git = "https://gitlab.com/veloren/auth.git", rev = "b943c85e4a38f5ec60cd18c34c73097640162bfe" } authc = { git = "https://gitlab.com/veloren/auth.git", rev = "bffb5181a35c19ddfd33ee0b4aedba741aafb68d" }
libsqlite3-sys = { version = "0.18", features = ["bundled"] } libsqlite3-sys = { version = "0.18", features = ["bundled"] }
diesel = { version = "1.4.3", features = ["sqlite"] } diesel = { version = "1.4.3", features = ["sqlite"] }
diesel_migrations = "1.4.0" diesel_migrations = "1.4.0"

View File

@ -24,7 +24,7 @@ pub struct LoginProvider {
impl LoginProvider { impl LoginProvider {
pub fn new(auth_addr: Option<String>) -> Self { pub fn new(auth_addr: Option<String>) -> Self {
let auth_server = match auth_addr { let auth_server = match auth_addr {
Some(addr) => Some(AuthClient::new(addr)), Some(addr) => Some(AuthClient::new(&addr).unwrap()),
None => None, None => None,
}; };