diff options
Diffstat (limited to 'teleterm/src/protocol.rs')
-rw-r--r-- | teleterm/src/protocol.rs | 20 |
1 files changed, 20 insertions, 0 deletions
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<Box<dyn crate::oauth::Oauth + Send>> { + 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<u8> for AuthType { |