diff options
author | Jesse Luehrs <doy@tozt.net> | 2019-11-26 05:06:02 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2019-11-26 05:10:01 -0500 |
commit | ff4ed4c72e9a841971563b98cd89839f59bc790c (patch) | |
tree | d33344909f50dc972189bb4810b6948b3e5c197c /teleterm/src/protocol.rs | |
parent | ea8beb985247aac4345ecefc8ec551f52f5f1a24 (diff) | |
download | teleterm-ff4ed4c72e9a841971563b98cd89839f59bc790c.tar.gz teleterm-ff4ed4c72e9a841971563b98cd89839f59bc790c.zip |
pass oauth login urls along to the browser
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 { |