Implement PLAIN auth for gst-meet

This commit is contained in:
Jasper Hugo 2022-03-09 19:36:29 +07:00 committed by Jasper
parent b89e1cde87
commit 1518fbe8e2
1 changed files with 16 additions and 1 deletions

View File

@ -47,6 +47,15 @@ struct Opt {
)]
focus_jid: Option<String>,
#[structopt(
long,
help = "If not specified, anonymous auth is used."
)]
xmpp_username: Option<String>,
#[structopt(long)]
xmpp_password: Option<String>,
#[structopt(
long,
default_value = "vp9",
@ -223,7 +232,13 @@ async fn main_inner() -> Result<()> {
let (connection, background) = Connection::new(
&opt.web_socket_url,
xmpp_domain,
Authentication::Anonymous,
match opt.xmpp_username {
Some(username) => Authentication::Plain {
username,
password: opt.xmpp_password.context("if xmpp-username is provided, xmpp-password must also be provided")?,
},
None => Authentication::Anonymous,
},
#[cfg(feature = "tls-insecure")]
opt.tls_insecure,
#[cfg(not(feature = "tls-insecure"))]