diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-27 15:03:47 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-27 15:19:47 -0500 |
commit | b15334fbbe186a10930e7343dff4e0fd3d693f38 (patch) | |
tree | c35a23347ce11dd7825e21776c4c60fa360c6819 /teleterm/src/protocol.rs | |
parent | 17449283628c76c0cbaa8c723750ff80aafdd7da (diff) | |
download | teleterm-b15334fbbe186a10930e7343dff4e0fd3d693f38.tar.gz teleterm-b15334fbbe186a10930e7343dff4e0fd3d693f38.zip |
refactor a bit
Diffstat (limited to 'teleterm/src/protocol.rs')
-rw-r--r-- | teleterm/src/protocol.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/teleterm/src/protocol.rs b/teleterm/src/protocol.rs index 29f72e9..dbb69a0 100644 --- a/teleterm/src/protocol.rs +++ b/teleterm/src/protocol.rs @@ -210,6 +210,22 @@ impl Auth { self.auth_type().is_oauth() } + pub fn oauth_client( + &self, + config: &crate::oauth::Config, + ) -> Option<Box<dyn crate::oauth::Oauth + Send>> { + self.auth_type().oauth_client(config, self.oauth_id()) + } + + pub fn oauth_id(&self) -> Option<&str> { + match self { + Self::RecurseCenter { id, .. } => { + id.as_ref().map(std::string::String::as_str) + } + _ => None, + } + } + pub fn name(&self) -> String { self.auth_type().name().to_string() } |