From 312725223355e15844b73d6c4e6680b45e23a28f Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 27 Nov 2019 15:56:52 -0500 Subject: simplify --- teleterm/src/server.rs | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/teleterm/src/server.rs b/teleterm/src/server.rs index 12bc731..28646ed 100644 --- a/teleterm/src/server.rs +++ b/teleterm/src/server.rs @@ -379,15 +379,25 @@ impl username, )); } - oauth if oauth.is_oauth() => match auth_client { - crate::protocol::AuthClient::Cli => { - return self - .handle_oauth_login_cli(conn, auth, term_type, size); - } - crate::protocol::AuthClient::Web => { - return self.handle_oauth_login_web(); + oauth if oauth.is_oauth() => { + log::info!( + "{}: login(oauth({}.{}), {:?})", + conn.id, + auth.name(), + auth_client.name(), + auth.oauth_id(), + ); + match auth_client { + crate::protocol::AuthClient::Cli => { + return self.handle_oauth_login_cli( + conn, auth, term_type, size, + ); + } + crate::protocol::AuthClient::Web => { + return self.handle_oauth_login_web(); + } } - }, + } _ => unreachable!(), } @@ -416,18 +426,10 @@ impl .get(&ty) .context(crate::error::AuthTypeMissingOauthConfig { ty })?; let refresh = auth.oauth_id().is_some(); - let client = auth.oauth_client(config).unwrap(); - conn.oauth_client = Some(client); + conn.oauth_client = Some(auth.oauth_client(config).unwrap()); let client = conn.oauth_client.as_ref().unwrap(); - log::info!( - "{}: login(oauth({}), {:?})", - conn.id, - auth.name(), - client.user_id() - ); - let token_filename = client.server_token_file(true); if let (Some(token_filename), true) = (token_filename, refresh) { let term_type = term_type.to_string(); -- cgit v1.2.3-54-g00ecf