Skip to content

Commit

Permalink
✨ zb: Add connection::Builder::auth_mechanism
Browse files Browse the repository at this point in the history
Unlike auth_mechanisms method, this method only allows one mechanism to
be set.
  • Loading branch information
zeenix committed Apr 29, 2024
1 parent a84504d commit 94b38b9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions zbus/src/blocking/connection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ impl<'a> Builder<'a> {
Self(crate::connection::Builder::socket(socket))
}

/// Specify the mechanism to use during authentication.
pub fn auth_mechanism(self, auth_mechanism: AuthMechanism) -> Self {
Self(self.0.auth_mechanism(auth_mechanism))
}

/// Specify the mechanisms to use during authentication.
pub fn auth_mechanisms(self, auth_mechanisms: &[AuthMechanism]) -> Self {
Self(self.0.auth_mechanisms(auth_mechanisms))
Expand Down
5 changes: 5 additions & 0 deletions zbus/src/connection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ impl<'a> Builder<'a> {
Ok(builder)
}

/// Specify the mechanism to use during authentication.
pub fn auth_mechanism(self, auth_mechanism: AuthMechanism) -> Self {
self.auth_mechanisms(&[auth_mechanism])
}

/// Specify the mechanisms to use during authentication.
pub fn auth_mechanisms(mut self, auth_mechanisms: &[AuthMechanism]) -> Self {
self.auth_mechanisms = Some(VecDeque::from(auth_mechanisms.to_vec()));
Expand Down

0 comments on commit 94b38b9

Please sign in to comment.