pub struct Sasl { /* private fields */ }Expand description
How the broker authenticates the connection, mapped onto the client’s SASL profiles.
Constructed with the per-mechanism constructors and passed to
AmqpBroker::sasl. A URL of the form amqp://user:pass@host also
selects PLAIN implicitly; an explicit profile set here wins.
§Examples
use ruststream_amqp::prelude::*;
#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
AmqpBroker::new("amqp://broker.internal:5672").sasl(Sasl::plain("svc", "secret")),
|b| {
b.include(handle);
},
)
}Implementations§
Source§impl Sasl
impl Sasl
Sourcepub fn anonymous() -> Self
pub fn anonymous() -> Self
SASL ANONYMOUS: no credentials, for brokers that allow unauthenticated connections.
§Examples
use ruststream_amqp::prelude::*;
#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
// The broker admits unauthenticated connections.
AmqpBroker::new("amqp://broker.internal:5672").sasl(Sasl::anonymous()),
|b| {
b.include(handle);
},
)
}Sourcepub fn plain(username: impl Into<String>, password: impl Into<String>) -> Self
pub fn plain(username: impl Into<String>, password: impl Into<String>) -> Self
SASL PLAIN: username and password.
§Examples
use ruststream_amqp::prelude::*;
#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
AmqpBroker::new("amqp://broker.internal:5672").sasl(Sasl::plain("svc", "secret")),
|b| {
b.include(handle);
},
)
}Sourcepub fn external() -> Self
pub fn external() -> Self
SASL EXTERNAL: the broker takes an identity established outside SASL.
The connection presents no client certificate: the crate exposes no TLS configuration, and the client opens TLS without client authentication.
§Examples
use ruststream_amqp::prelude::*;
#[ruststream::app]
fn app() -> impl App {
RustStream::new(AppInfo::new("orders", "0.1.0")).with_broker(
// The broker identifies the service outside SASL; no credentials travel here.
AmqpBroker::new("amqps://broker.internal:5671").sasl(Sasl::external()),
|b| {
b.include(handle);
},
)
}Trait Implementations§
Auto Trait Implementations§
impl Freeze for Sasl
impl RefUnwindSafe for Sasl
impl Send for Sasl
impl Sync for Sasl
impl Unpin for Sasl
impl UnsafeUnpin for Sasl
impl UnwindSafe for Sasl
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more