From ff4ed4c72e9a841971563b98cd89839f59bc790c Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Tue, 26 Nov 2019 05:06:02 -0500 Subject: pass oauth login urls along to the browser --- teleterm/src/protocol.rs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'teleterm/src/protocol.rs') diff --git a/teleterm/src/protocol.rs b/teleterm/src/protocol.rs index 130e52d..5633b8e 100644 --- a/teleterm/src/protocol.rs +++ b/teleterm/src/protocol.rs @@ -139,6 +139,26 @@ impl AuthType { .take_while(std::result::Result::is_ok) .map(std::result::Result::unwrap) } + + pub fn oauth_client( + 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!(), + } + } } impl std::convert::TryFrom for AuthType { -- cgit v1.2.3-54-g00ecf