Skip to content

Commit

Permalink
🗑️ zb: Deprecate connection::Builder::auth_mechansims
Browse files Browse the repository at this point in the history
In favor of `auth_mechansim`. This is in preparation for dbus2#731, when we
will remove this method entirely.
  • Loading branch information
zeenix committed Apr 29, 2024
1 parent 94b38b9 commit 8b1c4ed
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions zbus/src/blocking/connection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,9 @@ impl<'a> Builder<'a> {
}

/// Specify the mechanisms to use during authentication.
#[deprecated(since = "4.1.3", note = "Use `auth_mechanism` instead.")]
pub fn auth_mechanisms(self, auth_mechanisms: &[AuthMechanism]) -> Self {
#[allow(deprecated)]
Self(self.0.auth_mechanisms(auth_mechanisms))
}

Expand Down
2 changes: 2 additions & 0 deletions zbus/src/connection/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,12 @@ impl<'a> Builder<'a> {

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

/// Specify the mechanisms to use during authentication.
#[deprecated(since = "4.1.3", note = "Use `auth_mechanism` instead.")]
pub fn auth_mechanisms(mut self, auth_mechanisms: &[AuthMechanism]) -> Self {
self.auth_mechanisms = Some(VecDeque::from(auth_mechanisms.to_vec()));

Expand Down
10 changes: 5 additions & 5 deletions zbus/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ mod p2p_tests {
.server(guid)
.unwrap()
.p2p()
.auth_mechanisms(&[AuthMechanism::Anonymous]),
.auth_mechanism(AuthMechanism::Anonymous),
Builder::tcp_stream(p1).p2p(),
)
};
Expand All @@ -1489,7 +1489,7 @@ mod p2p_tests {
.server(guid)
.unwrap()
.p2p()
.auth_mechanisms(&[AuthMechanism::Anonymous]),
.auth_mechanism(AuthMechanism::Anonymous),
Builder::tcp_stream(p1).p2p(),
)
};
Expand Down Expand Up @@ -1568,7 +1568,7 @@ mod p2p_tests {
.server(guid)
.unwrap()
.p2p()
.auth_mechanisms(&[AuthMechanism::Anonymous])
.auth_mechanism(AuthMechanism::Anonymous)
.build(),
Builder::vsock_stream(client).p2p().build(),
)
Expand All @@ -1587,7 +1587,7 @@ mod p2p_tests {
.server(guid)
.unwrap()
.p2p()
.auth_mechanisms(&[AuthMechanism::Anonymous])
.auth_mechanism(AuthMechanism::Anonymous)
.build(),
Builder::vsock_stream(client).p2p().build(),
)
Expand Down Expand Up @@ -1655,7 +1655,7 @@ mod p2p_tests {
.server(guid)
.unwrap()
.p2p()
.auth_mechanisms(&[AuthMechanism::Cookie])
.auth_mechanism(AuthMechanism::Cookie)
.cookie_context(cookie_context)
.unwrap();
if let Some(cookie_id) = cookie_id {
Expand Down

0 comments on commit 8b1c4ed

Please sign in to comment.