aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-11-27 15:56:52 -0500
committerJesse Luehrs <doy@tozt.net>2019-11-27 15:56:52 -0500
commit312725223355e15844b73d6c4e6680b45e23a28f (patch)
tree342254be42d08294a3adfdf4d1b41f1427401459
parentb15334fbbe186a10930e7343dff4e0fd3d693f38 (diff)
downloadteleterm-312725223355e15844b73d6c4e6680b45e23a28f.tar.gz
teleterm-312725223355e15844b73d6c4e6680b45e23a28f.zip
simplify
-rw-r--r--teleterm/src/server.rs36
1 files 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<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static>
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<S: tokio::io::AsyncRead + tokio::io::AsyncWrite + Send + 'static>
.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();