XOAUTH2 support (closes #1194 closes #1369)

This commit is contained in:
mdecimus
2025-05-16 17:17:13 +02:00
parent f667da0d4f
commit dcdf68b774
9 changed files with 18 additions and 59 deletions

View File

@@ -7,9 +7,7 @@
use common::{
auth::{
AuthRequest,
sasl::{
sasl_decode_challenge_oauth, sasl_decode_challenge_plain, sasl_decode_challenge_xoauth,
},
sasl::{sasl_decode_challenge_oauth, sasl_decode_challenge_plain},
},
listener::SessionStream,
};
@@ -38,21 +36,13 @@ impl SaslToken {
},
}
.into(),
AUTH_OAUTHBEARER => SaslToken {
AUTH_OAUTHBEARER | AUTH_XOAUTH2 => SaslToken {
mechanism,
credentials: Credentials::OAuthBearer {
token: String::new(),
},
}
.into(),
AUTH_XOAUTH2 => SaslToken {
mechanism,
credentials: Credentials::XOauth2 {
username: String::new(),
secret: String::new(),
},
}
.into(),
_ => None,
}
}
@@ -96,17 +86,11 @@ impl<T: SessionStream> Session<T> {
.await
};
}
(AUTH_OAUTHBEARER, _) => {
(AUTH_OAUTHBEARER | AUTH_XOAUTH2, _) => {
if let Some(credentials) = sasl_decode_challenge_oauth(&response) {
return self.authenticate(credentials).await;
}
}
(AUTH_XOAUTH2, _) => {
if let Some(credentials) = sasl_decode_challenge_xoauth(&response) {
return self.authenticate(credentials).await;
}
}
_ => (),
}
}