From 81fc5c6a2c6df38025961945cb496ccc4d432036 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 26 Nov 2019 00:58:00 -0500 Subject: allow configuring the allowed login methods for the web server --- teleterm/src/web.rs | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'teleterm/src/web.rs') diff --git a/teleterm/src/web.rs b/teleterm/src/web.rs index bf39c47..d3a79d4 100644 --- a/teleterm/src/web.rs +++ b/teleterm/src/web.rs @@ -14,6 +14,8 @@ use gotham::state::FromState as _; struct Config { server_address: (String, std::net::SocketAddr), public_address: String, + allowed_login_methods: + std::collections::HashSet, } #[derive(Default, serde::Deserialize, serde::Serialize)] @@ -25,6 +27,8 @@ struct SessionData { struct WebConfig<'a> { username: Option<&'a str>, public_address: &'a str, + allowed_login_methods: + &'a std::collections::HashSet, } impl<'a> WebConfig<'a> { @@ -35,6 +39,7 @@ impl<'a> WebConfig<'a> { .as_ref() .map(std::string::String::as_str), public_address: &config.public_address, + allowed_login_methods: &config.allowed_login_methods, } } } @@ -48,10 +53,14 @@ impl Server { listen_address: std::net::SocketAddr, public_address: String, server_address: (String, std::net::SocketAddr), + allowed_login_methods: std::collections::HashSet< + crate::protocol::AuthType, + >, ) -> Self { let data = Config { server_address, public_address, + allowed_login_methods, }; Self { server: Box::new(gotham::init_server( -- cgit v1.2.3-54-g00ecf