aboutsummaryrefslogtreecommitdiffstats
path: root/teleterm/src/protocol.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2019-12-18 02:01:56 -0500
committerJesse Luehrs <doy@tozt.net>2019-12-18 02:01:56 -0500
commitc7312e513e8d9696fea66b198e3526bc0d9f6325 (patch)
tree046668edc5db35054a3e7891784b1e1d9fafeb15 /teleterm/src/protocol.rs
parentee5de447d977999e7f5b4b41685d74ce28d63535 (diff)
downloadteleterm-c7312e513e8d9696fea66b198e3526bc0d9f6325.tar.gz
teleterm-c7312e513e8d9696fea66b198e3526bc0d9f6325.zip
make the oauth client a struct instead of a trait
Diffstat (limited to 'teleterm/src/protocol.rs')
-rw-r--r--teleterm/src/protocol.rs24
1 files changed, 9 insertions, 15 deletions
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<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!(),
- }
+ ) -> Option<crate::oauth::Oauth> {
+ 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<Box<dyn crate::oauth::Oauth + Send>> {
+ ) -> Option<crate::oauth::Oauth> {
self.auth_type().oauth_client(config, self.oauth_id())
}