From c7312e513e8d9696fea66b198e3526bc0d9f6325 Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 18 Dec 2019 02:01:56 -0500 Subject: make the oauth client a struct instead of a trait --- teleterm/src/protocol.rs | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'teleterm/src/protocol.rs') diff --git a/teleterm/src/protocol.rs b/teleterm/src/protocol.rs index dbb69a0..b30b1f2 100644 --- a/teleterm/src/protocol.rs +++ b/teleterm/src/protocol.rs @@ -144,20 +144,14 @@ impl AuthType { self, config: &crate::oauth::Config, id: Option<&str>, - ) -> Option> { - match self { - Self::RecurseCenter => { - Some(Box::new(crate::oauth::RecurseCenter::new( - config.clone(), - &id.map_or_else( - || format!("{}", uuid::Uuid::new_v4()), - std::string::ToString::to_string, - ), - ))) - } - ty if !ty.is_oauth() => None, - _ => unreachable!(), - } + ) -> Option { + Some(crate::oauth::Oauth::new( + config.clone(), + id.map_or_else( + || format!("{}", uuid::Uuid::new_v4()), + std::string::ToString::to_string, + ), + )) } } @@ -213,7 +207,7 @@ impl Auth { pub fn oauth_client( &self, config: &crate::oauth::Config, - ) -> Option> { + ) -> Option { self.auth_type().oauth_client(config, self.oauth_id()) } -- cgit v1.2.3-54-g00ecf