pub struct Credential {
pub username: String,
pub password: String,
pub realm: Option<String>,
}Expand description
SIP Authentication Credentials
Credential contains the authentication information needed for SIP
digest authentication. This is used when a SIP server challenges
a request with a 401 Unauthorized or 407 Proxy Authentication Required
response.
§Fields
username- The username for authenticationpassword- The password for authenticationrealm- Optional authentication realm (extracted from challenge)
§Examples
§Basic Usage
let credential = Credential {
username: "alice".to_string(),
password: "secret123".to_string(),
realm: Some("example.com".to_string()),
};§Usage with Registration
let credential = Credential {
username: "alice".to_string(),
password: "secret123".to_string(),
realm: None, // Will be extracted from server challenge
};
// Use credential with registration
// let registration = Registration::new(endpoint.inner.clone(), Some(credential));§Usage with INVITE
let invite_option = InviteOption {
caller: rsip::Uri::try_from("sip:alice@example.com")?,
callee: rsip::Uri::try_from("sip:bob@example.com")?,
destination: None,
content_type: Some("application/sdp".to_string()),
offer: Some(sdp_bytes),
contact: rsip::Uri::try_from("sip:alice@192.168.1.100:5060")?,
credential: Some(credential),
headers: None,
};Fields§
§username: String§password: String§realm: Option<String>Trait Implementations§
Source§impl Clone for Credential
impl Clone for Credential
Source§fn clone(&self) -> Credential
fn clone(&self) -> Credential
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Credential
impl RefUnwindSafe for Credential
impl Send for Credential
impl Sync for Credential
impl Unpin for Credential
impl UnwindSafe for Credential
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